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 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::xadaptor_semantic< xtensor_adaptor< EC, N, L, Tag > >

Constructors

xtensor_adaptor(container_closure_type data)

Constructs an xtensor_adaptor of the given stl-like container.

Parameters
  • data: the container to adapt

xtensor_adaptor(container_closure_type data, const shape_type &shape, layout_type l = layout_type::row_major)

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

Parameters

xtensor_adaptor(container_closure_type 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.

xadapt (xtensor_adaptor)

Defined in xtensor/xadapt.hpp

template <class C, std::size_t N, layout_type L = DEFAULT_LAYOUT>
xtensor_adaptor<C, N, L> xt::xadapt(C &container, const std::array<typename C::size_type, N> &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 C, std::size_t N>
xtensor_adaptor<C, N, layout_type::dynamic> xt::xadapt(C &container, const std::array<typename C::size_type, N> &shape, const std::array<typename C::size_type, N> &strides)

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

Parameters

template <class P, std::size_t N, class O, layout_type L = DEFAULT_LAYOUT, class A = std::allocator<std::remove_pointer_t<P>>>
xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, L> xt::xadapt(P &pointer, typename A::size_type size, O ownership, const std::array<typename A::size_type, N> &shape, layout_type l = L, const A &alloc = A())

Constructs an xtensor_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 accept_ownership()
  • shape: the shape of the xtensor_adaptor
  • l: the layout_type of the xtensor_adaptor
  • alloc: the allocator used for allocating / deallocating the dynamic array

template <class P, std::size_t N, class O, class A = std::allocator<std::remove_pointer_t<P>>>
xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, layout_type::dynamic> xt::xadapt(P &pointer, typename A::size_type size, O ownership, const std::array<typename A::size_type, N> &shape, const std::array<typename A::size_type, N> &strides, const A &alloc = A())

Constructs an xtensor_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 accept_ownership()
  • shape: the shape of the xtensor_adaptor
  • strides: the strides of the xtensor_adaptor
  • alloc: the allocator used for allocating / deallocating the dynamic array