xtensor-python icon indicating copy to clipboard operation
xtensor-python copied to clipboard

Error with strided view

Open tdegeus opened this issue 3 years ago • 0 comments

With xt::pyarray<double> I'm getting a bit of a, to me, sketchy error:

In file included from /Users/tdegeus/data/prog/src/GooseFEM/python/main.cpp:12:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor-python/pyarray.hpp:17:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xbuffer_adaptor.hpp:22:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstorage.hpp:23:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xtensor_simd.hpp:16:
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xutils.hpp:830:31: error: implicit instantiation of undefined template 'xt::rebind_container<long, xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>>>'
        using type = typename rebind_container<std::ptrdiff_t, S>::type;
                              ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xutils.hpp:843:5: note: in instantiation of template class 'xt::get_strides_type<xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>>>' requested here
    using get_strides_t = typename get_strides_type<C>::type;
    ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:93:36: note: in instantiation of template type alias 'get_strides_t' requested here
        using inner_strides_type = get_strides_t<inner_shape_type>;
                                   ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xiterable.hpp:43:43: note: in instantiation of template class 'xt::xiterable_inner_types<xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>>' requested here
        using inner_shape_type = typename iterable_types::inner_shape_type;
                                          ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xiterable.hpp:151:30: note: in instantiation of template class 'xt::xconst_iterable<xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>>' requested here
    class xiterable : public xconst_iterable<D>
                             ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:133:34: note: in instantiation of template class 'xt::xiterable<xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>>' requested here
                          public select_iterable_base_t<L, std::decay_t<CT>::static_layout, xstrided_view<CT, S, L, FST>>,
                                 ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:664:16: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
        return view_type(std::forward<E>(e), std::forward<S>(shape), std::forward<X>(strides), offset, layout);
               ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Allocate.hpp:80:23: note: in instantiation of function template specialization 'xt::strided_view<xt::layout_type::dynamic, const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, std::__1::vector<long>>' requested here
            ret = xt::strided_view(arg, ret.shape(), std::move(ret_strides), 0ul, xt::layout_type::dynamic);
                      ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Allocate.hpp:148:63: note: in instantiation of member function 'GooseFEM::detail::asTensor_write<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>, void>::impl' requested here
    detail::asTensor_write<std::decay_t<T>, std::decay_t<R>>::impl(arg, ret);
                                                              ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Element.hpp:143:15: note: in instantiation of function template specialization 'GooseFEM::asTensor<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>>' requested here
    GooseFEM::asTensor(arg, ret);
              ^
/Users/tdegeus/data/prog/src/GooseFEM/python/Element.hpp:28:98: note: in instantiation of function template specialization 'GooseFEM::Element::QuadratureBase<GooseFEM::Element::Quad4::Quadrature>::asTensor<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>>' requested here
            static_cast<void (C::*)(const xt::pyarray<double>&, xt::pyarray<double>&) const>(&C::asTensor),
                                                                                                 ^
/Users/tdegeus/data/prog/src/GooseFEM/python/ElementQuad4.hpp:34:5: note: in instantiation of function template specialization 'register_Element_QuadratureBase<GooseFEM::Element::Quad4::Quadrature, pybind11::class_<GooseFEM::Element::Quad4::Quadrature>>' requested here
    register_Element_QuadratureBase<GooseFEM::Element::Quad4::Quadrature>(qdr);
    ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xutils.hpp:79:12: note: template is declared here
    struct rebind_container;
           ^
In file included from /Users/tdegeus/data/prog/src/GooseFEM/python/main.cpp:12:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor-python/pyarray.hpp:22:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor-python/pycontainer.hpp:35:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xcontainer.hpp:25:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xmath.hpp:28:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xmanipulation.hpp:13:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xbuilder.hpp:31:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xgenerator.hpp:27:
In file included from /Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:27:
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view_base.hpp:191:38: error: type 'xt::xstrided_view_base<xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>>::strides_type' (aka 'int') cannot be used prior to '::' because it has no members
        using offset_type = typename strides_type::value_type;
                                     ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:134:35: note: in instantiation of template class 'xt::xstrided_view_base<xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>>' requested here
                          private xstrided_view_base<xstrided_view<CT, S, L, FST>>,
                                  ^
/Users/tdegeus/opt/miniconda3/envs/stable/include/xtensor/xstrided_view.hpp:664:16: note: in instantiation of template class 'xt::xstrided_view<const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, xt::layout_type::dynamic, xt::detail::inner_storage_getter<const xt::pyarray<double, xt::layout_type::dynamic> &>>' requested here
        return view_type(std::forward<E>(e), std::forward<S>(shape), std::forward<X>(strides), offset, layout);
               ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Allocate.hpp:80:23: note: in instantiation of function template specialization 'xt::strided_view<xt::layout_type::dynamic, const xt::pyarray<double, xt::layout_type::dynamic> &, const xt::xbuffer_adaptor<unsigned long *, xt::no_ownership, std::__1::allocator<unsigned long>> &, std::__1::vector<long>>' requested here
            ret = xt::strided_view(arg, ret.shape(), std::move(ret_strides), 0ul, xt::layout_type::dynamic);
                      ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Allocate.hpp:148:63: note: in instantiation of member function 'GooseFEM::detail::asTensor_write<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>, void>::impl' requested here
    detail::asTensor_write<std::decay_t<T>, std::decay_t<R>>::impl(arg, ret);
                                                              ^
/Users/tdegeus/data/prog/src/GooseFEM/include/GooseFEM/Element.hpp:143:15: note: in instantiation of function template specialization 'GooseFEM::asTensor<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>>' requested here
    GooseFEM::asTensor(arg, ret);
              ^
/Users/tdegeus/data/prog/src/GooseFEM/python/Element.hpp:28:98: note: in instantiation of function template specialization 'GooseFEM::Element::QuadratureBase<GooseFEM::Element::Quad4::Quadrature>::asTensor<xt::pyarray<double, xt::layout_type::dynamic>, xt::pyarray<double, xt::layout_type::dynamic>>' requested here
            static_cast<void (C::*)(const xt::pyarray<double>&, xt::pyarray<double>&) const>(&C::asTensor),
                                                                                                 ^
/Users/tdegeus/data/prog/src/GooseFEM/python/ElementQuad4.hpp:34:5: note: in instantiation of function template specialization 'register_Element_QuadratureBase<GooseFEM::Element::Quad4::Quadrature, pybind11::class_<GooseFEM::Element::Quad4::Quadrature>>' requested here
    register_Element_QuadratureBase<GooseFEM::Element::Quad4::Quadrature>(qdr);
    ^
2 errors generated.
make[2]: *** [CMakeFiles/mypymod.dir/python/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/mypymod.dir/all] Error 2
make: *** [all] Error 2

tdegeus avatar May 31 '21 11:05 tdegeus