xoptional_assembly¶
Defined in xtensor/xoptional_assembly.hpp
-
template<class
VE
, classFE
>
classxoptional_assembly
: public xt::xoptional_assembly_base<xoptional_assembly<VE, FE>>, public xt::xcontainer_semantic<xoptional_assembly<VE, FE>>¶ Dense multidimensional container holding optional values, optimized for tensor operations.
The xoptional_assembly class implements a dense multidimensional container hoding optional values. This container is optimized of tensor operations: contrary to xarray_optional, xoptional_assembly holds two separated expressions, one for the values, the other for the missing mask.
- Template Parameters
VE
: The type of expression holding the values.FE
: The type of expression holding the missing mask.
Constructors
-
xoptional_assembly
()¶ Allocates an uninitialized xoptional_assembly that holds 0 element.
-
xoptional_assembly
(const shape_type &shape, layout_type l = base_type::static_layout)¶ Allocates an uninitialized xoptional_assembly with the specified shape and layout_type.
- Parameters
shape
: the shape of the xoptional_assemblyl
: the layout_type of the xoptional_assembly
-
xoptional_assembly
(const shape_type &shape, const value_type &value, layout_type l = base_type::static_layout)¶ Allocates an xoptional_assembly with the specified shape and layout_type.
Elements are initialized to the specified value.
- Parameters
shape
: the shape of the xoptional_assemblyvalue
: the value of the elementsl
: the layout_type of the xoptional_assembly
-
xoptional_assembly
(const shape_type &shape, const strides_type &strides)¶ Allocates an uninitialized xoptional_assembly with the specified shape and strides.
- Parameters
shape
: the shape of the xoptional_assemblystrides
: the strides of the xoptional_assembly
-
xoptional_assembly
(const shape_type &shape, const strides_type &strides, const value_type &value)¶ Allocates an uninitialized xoptional_assembly with the specified shape and strides.
Elements are initialized to the specified value.
- Parameters
shape
: the shape of the xoptional_assemblystrides
: the strides of the xoptional_assemblyvalue
: the value of the elements
-
xoptional_assembly
(const VE &ve)¶ Allocates an xoptional_assembly from the specified value expression.
The flag expression is initialized as if no value is missing.
- Parameters
ve
: the expression holding the values
-
xoptional_assembly
(VE &&ve)¶ Allocates an xoptional_assembly from the specified value expression.
The flag expression is initialized as if no value is missing. The value expression is moved inside the xoptional_assembly and is therefore not available after the xoptional_assembly has been constructed.
- Parameters
ve
: the expression holding the values
-
template<class
OVE
, classOFE
, typename = std::enable_if_t<is_xexpression<OVE>::value && is_xexpression<OFE>::value>>xoptional_assembly
(OVE &&ove, OFE &&ofe)¶ Allocates an xoptional_assembly from the specified value expression and missing mask expression.
- Parameters
ove
: the expression holding the valuesofe
: the expression holding the missing mask
-
xoptional_assembly
(const value_type &value)¶ Allocates an xoptional_assembly that holds a single element initialized to the specified value.
- Parameters
value
: the value of the element
Constructors from initializer list
-
xoptional_assembly
(nested_initializer_list_t<value_type, 1> t)¶ Allocates a one-dimensional xoptional_assembly.
- Parameters
t
: the elements of the xoptional_assembly
-
xoptional_assembly
(nested_initializer_list_t<value_type, 2> t)¶ Allocates a two-dimensional xoptional_assembly.
- Parameters
t
: the elements of the xoptional_assembly
-
xoptional_assembly
(nested_initializer_list_t<value_type, 3> t)¶ Allocates a three-dimensional xoptional_assembly.
- Parameters
t
: the elements of the xoptional_assembly
-
xoptional_assembly
(nested_initializer_list_t<value_type, 4> t)¶ Allocates a four-dimensional xoptional_assembly.
- Parameters
t
: the elements of the xoptional_assembly
-
xoptional_assembly
(nested_initializer_list_t<value_type, 5> t)¶ Allocates a five-dimensional xoptional_assembly.
- Parameters
t
: the elements of the xoptional_assembly
Extended copy semantic
-
template<class
E
>xoptional_assembly
(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
>
xoptional_assembly<VE, FE>from_shape
(S &&s)¶ Allocates and returns an xoptional_assembly with the specified shape.
- Parameters
s
: the shape of the xoptional_assembly