xmasked_view
Defined in xtensor/xmasked_view.hpp
-
template<class CTD, class CTM>
class xmasked_view : public xt::xview_semantic<xmasked_view<CTD, CTM>>, private xt::xaccessible<xmasked_view<CTD, CTM>>, private xt::xiterable<xmasked_view<CTD, CTM>> View on an xoptional_assembly or xoptional_assembly_adaptor hiding values depending on a given mask.
The xmasked_view class implements a view on an xoptional_assembly or xoptional_assembly_adaptor, it takes this xoptional_assembly and a mask as input. The mask is an xexpression containing boolean values, whenever the value of the mask is false, the optional value of xmasked_view is considered missing, otherwise it depends on the underlying xoptional_assembly.
- Template Parameters:
CTD – The type of expression holding the values.
CTM – The type of expression holding the mask.
Constructors
-
template<class D, class M>
inline xmasked_view(D &&data, M &&mask) Creates an xmasked_view, given the xoptional_assembly or xoptional_assembly_adaptor and the mask.
- Parameters:
data – the underlying xoptional_assembly or xoptional_assembly_adaptor
mask – the mask.
Size and shape
-
inline size_type size() const noexcept
Returns the number of elements in the xmasked_view.
-
inline const inner_shape_type &shape() const noexcept
Returns the shape of the xmasked_view.
-
inline const inner_strides_type &strides() const noexcept
Returns the strides of the xmasked_view.
-
inline const inner_backstrides_type &backstrides() const noexcept
Returns the backstrides of the xmasked_view.
-
inline layout_type layout() const noexcept
Return the layout_type of the xmasked_view.
- Returns:
layout_type of the xmasked_view
Data
-
inline data_type &value() noexcept
Return an expression for the values of the xmasked_view.
-
inline const data_type &value() const noexcept
Return a constant expression for the values of the xmasked_view.
-
inline mask_type &visible() noexcept
Return an expression for the mask of the xmasked_view.
-
inline const mask_type &visible() const noexcept
Return a constant expression for the mask of the xmasked_view.
-
template<class ...Args>
inline reference operator()(Args... args) Returns a reference to the element at the specified position in the xmasked_view.
- Parameters:
args – a list of indices specifying the position in the xmasked_view. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the xmasked_view.
-
template<class ...Args>
inline const_reference operator()(Args... args) const Returns a constant reference to the element at the specified position in the xmasked_view.
- Parameters:
args – a list of indices specifying the position in the xmasked_view. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the xmasked_view.
-
template<class ...Args>
inline reference unchecked(Args... args) Returns a reference to the element at the specified position in the xmasked_view.
Warning
This method is meant for performance, for expressions with a dynamic number of dimensions (i.e. not known at compile time). Since it may have undefined behavior (see parameters), operator() should be preferred whenever it is possible.
Warning
This method is NOT compatible with broadcasting, meaning the following code has undefined behavior:
xt::xarray<double> a = {{0, 1}, {2, 3}}; xt::xarray<double> b = {0, 1}; auto fd = a + b; double res = fd.uncheked(0, 1);
- Parameters:
args – a list of indices specifying the position in the xmasked_view. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the xmasked_view, else the behavior is undefined.
-
template<class ...Args>
inline const_reference unchecked(Args... args) const Returns a constant reference to the element at the specified position in the xmasked_view.
Warning
This method is meant for performance, for expressions with a dynamic number of dimensions (i.e. not known at compile time). Since it may have undefined behavior (see parameters), operator() should be preferred whenever it is possible.
Warning
This method is NOT compatible with broadcasting, meaning the following code has undefined behavior:
xt::xarray<double> a = {{0, 1}, {2, 3}}; xt::xarray<double> b = {0, 1}; auto fd = a + b; double res = fd.uncheked(0, 1);
- Parameters:
args – a list of indices specifying the position in the xmasked_view. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the xmasked_view, else the behavior is undefined.
-
template<class It>
inline reference element(It first, It last) Returns a reference to the element at the specified position in the xmasked_view.
- Parameters:
first – iterator starting the sequence of indices
last – iterator ending the sequence of indices The number of indices in the sequence should be equal to or greater than the number of dimensions of the xmasked_view.
-
template<class It>
inline const_reference element(It first, It last) const Returns a constant reference to the element at the specified position in the xmasked_view.
- Parameters:
first – iterator starting the sequence of indices
last – iterator ending the sequence of indices The number of indices in the sequence should be equal to or greater than the number of dimensions of the xmasked_view.
Public Functions
-
inline reference back()
Returns a reference to the last element of the expression.
-
inline const_reference back() const
Returns a constant reference to last the element of the expression.
-
inline reference front()
Returns a reference to the first element of the expression.
-
inline const_reference front() const
Returns a constant reference to first the element of the expression.