xtensor_adaptor

Defined in xtensor/xtensor.hpp

template <class EC, std::size_t N, layout_type L, class Tag>
class xt::xtensor_adaptor

Dense multidimensional container adaptor with tensor semantic and fixed dimension.

The xtensor_adaptor class implements a dense multidimensional container adaptor with tensor semantic and fixed dimension. It is used to provide a multidimensional container semantic and a tensor semantic to stl-like containers.

Template Parameters
  • EC: The closure for the container type to adapt.
  • N: The dimension of the adaptor.
  • L: The layout_type of the adaptor.
  • Tag: The expression tag.

Inherits from xt::xstrided_container< xtensor_adaptor< EC, N, L, Tag > >, xt::xcontainer_semantic< xtensor_adaptor< EC, N, L, Tag > >

Constructors

xtensor_adaptor(container_type &&data)

Constructs an xtensor_adaptor of the given stl-like container.

Parameters
  • data: the container to adapt

xtensor_adaptor(const container_type &data)

Constructs an xtensor_adaptor of the given stl-like container.

Parameters
  • data: the container to adapt

template <class D>
xtensor_adaptor(D &&data, const shape_type &shape, layout_type l = L)

Constructs an xtensor_adaptor of the given stl-like container, with the specified shape and layout_type.

Parameters

template <class D>
xtensor_adaptor(D &&data, const shape_type &shape, const strides_type &strides)

Constructs an xtensor_adaptor of the given stl-like container, with the specified shape and strides.

Parameters

Extended copy semantic

template <class E>
auto operator=(const xexpression<E> &e)

The extended assignment operator.

adapt (xtensor_adaptor)

Defined in xtensor/xadapt.hpp

template <class C, layout_type L = layout_type::row_major>
xtensor_adaptor<C, 1, L> xt::adapt(C &&container, layout_type l = L)

Constructs a 1D xtensor_adaptor of the given stl-like container, with the specified layout_type.

Parameters
  • container: the container to adapt
  • l: the layout_type of the xtensor_adaptor

template <class C, class SC, layout_type L = layout_type::row_major, typename std::enable_if_t<!detail::is_array< std::decay_t< SC >>::value, int > = 0>
xarray_adaptor<xtl::closure_type_t<C>, L, std::decay_t<SC>> xt::adapt(C &&container, const SC &shape, layout_type l = L)

Constructs an xarray_adaptor of the given stl-like container, with the specified shape and layout.

Parameters

template <class C, class SC, class SS, typename std::enable_if_t< detail::is_array< std::decay_t< SC >>::value, int > = 0>
xtensor_adaptor<C, detail::array_size<SC>::value, layout_type::dynamic> xt::adapt(C &&container, SC &&shape, SS &&strides)

Constructs an xtensor_adaptor of the given stl-like container, with the specified shape and strides.

Parameters

template <class P, class O, layout_type L = layout_type::row_major, class A = std::allocator<std::remove_pointer_t<std::remove_reference_t<P>>>>
xtensor_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, 1, L> xt::adapt(P &&pointer, typename A::size_type size, O ownership, layout_type l = L, const A &alloc = A())

Constructs a 1D xtensor_adaptor of the given dynamically allocated C array, with the specified layout.

Parameters
  • pointer: the pointer to the beginning of the dynamic array
  • size: the size of the dynamic array
  • ownership: indicates whether the adaptor takes ownership of the array. Possible values are no_ownerhsip() or acquire_ownership()
  • l: the layout_type of the xtensor_adaptor
  • alloc: the allocator used for allocating / deallocating the dynamic array

template <class P, class O, class SC, layout_type L = layout_type::row_major, class A = std::allocator<std::remove_pointer_t<std::remove_reference_t<P>>>, typename std::enable_if_t<!detail::is_array< std::decay_t< SC >>::value, int > = 0>
xarray_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, L, SC> xt::adapt(P &&pointer, typename A::size_type size, O ownership, const SC &shape, layout_type l = L, const A &alloc = A())

Constructs an xarray_adaptor of the given dynamically allocated C array, with the specified shape and layout.

Parameters
  • pointer: the pointer to the beginning of the dynamic array
  • size: the size of the dynamic array
  • ownership: indicates whether the adaptor takes ownership of the array. Possible values are no_ownerhsip() or acquire_ownership()
  • shape: the shape of the xarray_adaptor
  • l: the layout_type of the xarray_adaptor
  • alloc: the allocator used for allocating / deallocating the dynamic array

template <class P, class O, class SC, class SS, class A = std::allocator<std::remove_pointer_t<std::remove_reference_t<P>>>, typename std::enable_if_t<!detail::is_array< std::decay_t< SC >>::value, int > = 0>
xarray_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, layout_type::dynamic, std::decay_t<SC>> xt::adapt(P &&pointer, typename A::size_type size, O ownership, SC &&shape, SS &&strides, const A &alloc = A())

Constructs an xarray_adaptor of the given dynamically allocated C array, with the specified shape and layout.

Parameters
  • pointer: the pointer to the beginning of the dynamic array
  • size: the size of the dynamic array
  • ownership: indicates whether the adaptor takes ownership of the array. Possible values are no_ownerhsip() or acquire_ownership()
  • shape: the shape of the xarray_adaptor
  • strides: the strides of the xarray_adaptor
  • alloc: the allocator used for allocating / deallocating the dynamic array