xarray¶
Defined in xtensor/xarray.hpp
-
template<class
EC
, layout_typeL
, classSC
, classTag
>
classxarray_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
- 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
shape
: the shape of the xarray_containerl
: the layout_type of the xarray_container
-
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
shape
: the shape of the xarray_containervalue
: the value of the elementsl
: the layout_type of the xarray_container
-
xarray_container
(const shape_type &shape, const strides_type &strides)¶ Allocates an uninitialized xarray_container with the specified shape and strides.
- Parameters
shape
: the shape of the xarray_containerstrides
: the strides of the xarray_container
-
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
shape
: the shape of the xarray_containerstrides
: the strides of the xarray_containervalue
: the value of the elements
-
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
storage
: the data for the xarray_containershape
: the shape of the xarray_containerstrides
: the strides of the xarray_container
-
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
t
: the elements of the xarray_container
-
xarray_container
(nested_initializer_list_t<value_type, 2> t)¶ Allocates a two-dimensional xarray_container.
- Parameters
t
: the elements of the xarray_container
-
xarray_container
(nested_initializer_list_t<value_type, 3> t)¶ Allocates a three-dimensional xarray_container.
- Parameters
t
: the elements of the xarray_container
-
xarray_container
(nested_initializer_list_t<value_type, 4> t)¶ Allocates a four-dimensional xarray_container.
- Parameters
t
: the elements of the xarray_container
-
xarray_container
(nested_initializer_list_t<value_type, 5> t)¶ Allocates a five-dimensional xarray_container.
- Parameters
t
: the elements of the xarray_container
Extended copy semantic
-
template<class
E
>xarray_container
(const xexpression<E> &e)¶ The extended copy constructor.
-
template<class
E
>
autooperator=
(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
s
: the shape of the xarray_container
-
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.