xarray

Defined in xtensor/xarray.hpp

template<class EC, layout_type L, class SC, class Tag>
class xarray_container : public xt::xstrided_container<xarray_container<EC, L, SC, Tag>>, public xt::xcontainer_semantic<xarray_container<EC, L, SC, Tag>>, public extension::xarray_container_base_t<EC, L, SC, Tag>

Dense multidimensional container with tensor semantic.

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

See

xarray, xstrided_container, xcontainer

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.

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(storage_type &&storage, 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.

Public Functions

template<class S>
xarray_container<EC, L, SC, Tag> from_shape(S &&s)

Allocates and returns an xarray_container with the specified shape.

Parameters

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: XTENSOR_DEFAULT_LAYOUT).

  • A: The allocator of the container holding the elements.

  • SA: The allocator of the containers holding the shape and the strides.

typedef xt::xarray_optional

Alias template on xarray_container for handling missing values.

Template Parameters
  • T: The value type of the elements.

  • L: The layout_type of the container (default: XTENSOR_DEFAULT_LAYOUT).

  • A: The allocator of the container holding the elements.

  • BA: The allocator of the container holding the missing flags.

  • SA: The allocator of the containers holding the shape and the strides.