inline auto add(xt::pyarray<double> &a, xt::pyarray<double> &b)
{
auto res = xt::pyarray<double>();
res.reshape(a.shape());
xt::noalias(res) = (a + b);
return res;
}
fails to compile with:
src/main.cpp: In function ‘auto add(xt::pyarray<double>&, xt::pyarray<double>&)’:
src/main.cpp:26:26: error: no matching function for call to ‘xt::pyarray<double>::reshape(const inner_shape_type&)’
res.reshape(a.shape());
^
In file included from /home/wolfv/Programs/xtensor-python/include/xtensor-python/pyarray.hpp:20:0,
from src/main.cpp:8:
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:222:17: note: candidate: void xt::pycontainer<D>::reshape(const shape_type&) [with D = xt::pyarray<double>; xt::pycontainer<D>::shape_type = std::vector<long unsigned int>]
inline void pycontainer<D>::reshape(const shape_type& shape)
^~~~~~~~~~~~~~
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:222:17: note: no known conversion for argument 1 from ‘const inner_shape_type {aka const xt::xbuffer_adaptor<long unsigned int>}’ to ‘const shape_type& {aka const std::vector<long unsigned int>&}’
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:236:17: note: candidate: void xt::pycontainer<D>::reshape(const shape_type&, xt::layout_type) [with D = xt::pyarray<double>; xt::pycontainer<D>::shape_type = std::vector<long unsigned int>]
inline void pycontainer<D>::reshape(const shape_type& shape, layout_type l)
^~~~~~~~~~~~~~
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:236:17: note: candidate expects 2 arguments, 1 provided
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:249:17: note: candidate: void xt::pycontainer<D>::reshape(const shape_type&, const strides_type&) [with D = xt::pyarray<double>; xt::pycontainer<D>::shape_type = std::vector<long unsigned int>; xt::pycontainer<D>::strides_type = std::vector<long unsigned int>]
inline void pycontainer<D>::reshape(const shape_type& shape, const strides_type& strides)
^~~~~~~~~~~~~~
/home/wolfv/Programs/xtensor-python/include/xtensor-python/pycontainer.hpp:249:17: note: candidate expects 2 arguments, 1 provided
fails to compile with: