xarray

Defined in xtensor/xarray.hpp

template <class EC, layout_type L, class SC, class Tag>
class xt::xarray_container

Dense multidimensional container with tensor semantic.

The xarray_container class implements a dense multidimensional container with tensor semantic.

See
xarray
Template Parameters
  • EC: The type of the container holding the elements.
  • L: The layout_type of the container.
  • SC: The type of the containers holding the shape and the strides.
  • Tag: The expression tag.

Inherits from xt::xstrided_container< xarray_container< EC, L, SC, Tag > >, xt::xcontainer_semantic< xarray_container< EC, L, SC, Tag > >

Constructors

xarray_container()

Allocates an uninitialized xarray_container that holds 0 element.

xarray_container(const shape_type &shape, layout_type l = L)

Allocates an uninitialized xarray_container with the specified shape and layout_type.

Parameters

xarray_container(const shape_type &shape, const_reference value, layout_type l = L)

Allocates an xarray_container with the specified shape and layout_type.

Elements are initialized to the specified value.

Parameters

xarray_container(const shape_type &shape, const strides_type &strides)

Allocates an uninitialized xarray_container with the specified shape and strides.

Parameters

xarray_container(const shape_type &shape, const strides_type &strides, const_reference value)

Allocates an uninitialized xarray_container with the specified shape and strides.

Elements are initialized to the specified value.

Parameters

xarray_container(container_type &&data, inner_shape_type &&shape, inner_strides_type &&strides)

Allocates an xarray_container by moving specified data, shape and strides.

Parameters

xarray_container(const value_type &t)

Allocates an xarray_container that holds a single element initialized to the specified value.

Parameters
  • t: the value of the element

Constructors from initializer list

xarray_container(nested_initializer_list_t<value_type, 1> t)

Allocates a one-dimensional xarray_container.

Parameters

xarray_container(nested_initializer_list_t<value_type, 2> t)

Allocates a two-dimensional xarray_container.

Parameters

xarray_container(nested_initializer_list_t<value_type, 3> t)

Allocates a three-dimensional xarray_container.

Parameters

xarray_container(nested_initializer_list_t<value_type, 4> t)

Allocates a four-dimensional xarray_container.

Parameters

xarray_container(nested_initializer_list_t<value_type, 5> t)

Allocates a five-dimensional xarray_container.

Parameters

Extended copy semantic

template <class E>
xarray_container(const xexpression<E> &e)

The extended copy constructor.

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

The extended assignment operator.

typedef xt::xarray

Alias template on xarray_container with default parameters for data container type and shape / strides container type.

This allows to write

xt::xarray<double> a = {{1., 2.}, {3., 4.}};

instead of the heavier syntax

xt::xarray_container<std::vector<double>, std::vector<std::size_t>> a = ...

Template Parameters
  • T: The value type of the elements.
  • L: The layout_type of the xarray_container (default: row_major).
  • A: The allocator of the container holding the elements.
  • SA: The allocator of the containers holding the shape and the strides.