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 also
- 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
-
inline xarray_container()
Allocates an uninitialized xarray_container that holds 0 element.
-
inline explicit 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_container
l – the layout_type of the xarray_container
-
inline explicit 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_container
value – the value of the elements
l – the layout_type of the xarray_container
-
inline explicit 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_container
strides – the strides of the xarray_container
-
inline explicit 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_container
strides – the strides of the xarray_container
value – the value of the elements
-
inline explicit 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_container
shape – the shape of the xarray_container
strides – the strides of the xarray_container
-
inline 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
-
inline xarray_container(nested_initializer_list_t<value_type, 1> t)
Allocates a one-dimensional xarray_container.
- Parameters:
t – the elements of the xarray_container
-
inline xarray_container(nested_initializer_list_t<value_type, 2> t)
Allocates a two-dimensional xarray_container.
- Parameters:
t – the elements of the xarray_container
-
inline xarray_container(nested_initializer_list_t<value_type, 3> t)
Allocates a three-dimensional xarray_container.
- Parameters:
t – the elements of the xarray_container
-
inline xarray_container(nested_initializer_list_t<value_type, 4> t)
Allocates a four-dimensional xarray_container.
- Parameters:
t – the elements of the xarray_container
-
inline xarray_container(nested_initializer_list_t<value_type, 5> t)
Allocates a five-dimensional xarray_container.
- Parameters:
t – the elements of the xarray_container
-
template<class S>
inline 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
Extended copy semantic
-
template<class E>
inline xarray_container(const xexpression<E> &e) The extended copy constructor.
-
template<class E>
inline auto operator=(const xexpression<E> &e) -> self_type& The extended assignment operator.
-
typedef xarray_container<uvector<T, A>, L, xt::svector<typename uvector<T, A>::size_type, 4, SA, true>> 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 xarray_container<xtl::xoptional_vector<T, A, BC>, L, xt::svector<typename uvector<T, A>::size_type, 4, SA, true>, xoptional_expression_tag> 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.