xoptional_assembly_base

Defined in xtensor/xoptional_assembly_base.hpp

template <class D>
class xt::xoptional_assembly_base

Inherits from xt::xiterable< D >

Size and shape

auto xt::xoptional_assembly_basesize() const

Returns the number of element in the optional assembly.

auto constexpr xt::xoptional_assembly_basedimension() const

Returns the number of dimensions of the optional assembly.

auto xt::xoptional_assembly_baseshape() const

Returns the shape of the optional assembly.

auto xt::xoptional_assembly_basestrides() const

Returns the strides of the optional assembly.

auto xt::xoptional_assembly_basebackstrides() const

Returns the backstrides of the optional assembly.

Data

template <class… Args>
auto xt::xoptional_assembly_baseoperator()(Args... args)

Returns a reference to the element at the specified position in the optional assembly.

Parameters
  • args: a list of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the optional assembly.

template <class… Args>
auto xt::xoptional_assembly_baseoperator()(Args... args) const

Returns a constant reference to the element at the specified position in the optional assembly.

Parameters
  • args: a list of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the optional assembly.

template <class… Args>
auto xt::xoptional_assembly_baseat(Args... args)

Returns a reference to the element at the specified position in the optional assembly, after dimension and bounds checking.

Parameters
  • args: a list of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the optional assembly.
Exceptions
  • std::out_of_range: if the number of argument is greater than the number of dimensions or if indices are out of bounds.

template <class… Args>
auto xt::xoptional_assembly_baseat(Args... args) const

Returns a constant reference to the element at the specified position in the optional assembly, after dimension and bounds checking.

Parameters
  • args: a list of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the optional assembly.
Exceptions
  • std::out_of_range: if the number of argument is greater than the number of dimensions or if indices are out of bounds.

template <class S>
auto xt::xoptional_assembly_baseoperator[](const S &index)

Returns a reference to the element at the specified position in the optional assembly.

Parameters
  • index: a sequence of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the optional assembly.

template <class S>
auto xt::xoptional_assembly_baseoperator[](const S &index) const

Returns a constant reference to the element at the specified position in the optional assembly.

Parameters
  • index: a sequence of indices specifying the position in the optional assembly. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the optional assembly.

template <class It>
auto xt::xoptional_assembly_baseelement(It first, It last)

Returns a reference to the element at the specified position in the optional assembly.

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 optional assembly.

template <class It>
auto xt::xoptional_assembly_baseelement(It first, It last) const

Returns a constant reference to the element at the specified position in the optional assembly.

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 optional assembly.

Broadcasting

template <class S>
bool xt::xoptional_assembly_basebroadcast_shape(S &shape, bool reuse_cache = false) const

Broadcast the shape of the optional assembly to the specified parameter.

Return
a boolean indicating whether the broadcasting is trivial
Parameters
  • shape: the result shape

template <class S>
bool xt::xoptional_assembly_baseis_trivial_broadcast(const S &strides) const

Compares the specified strides with those of the optional assembly to see whether the broadcasting is trivial.

Return
a boolean indicating whether the broadcasting is trivial

Public Functions

template <class S = shape_type>
void xt::xoptional_assembly_baseresize(const S &shape, bool force = false)

Resizes the optional assembly.

Parameters
  • shape: the new shape
  • force: force reshaping, even if the shape stays the same (default: false)

template <class S = shape_type>
void xt::xoptional_assembly_baseresize(const S &shape, layout_type l)

Resizes the optional assembly.

Parameters
  • shape: the new shape
  • l: the new layout_type

template <class S = shape_type>
void xt::xoptional_assembly_baseresize(const S &shape, const strides_type &strides)

Resizes the optional assembly.

Parameters
  • shape: the new shape
  • strides: the new strides

template <class S = shape_type>
void xt::xoptional_assembly_basereshape(const S &shape, layout_type layout = static_layout)

Reshapes the optional assembly.

Parameters
  • shape: the new shape
  • layout: the new layout

layout_type xt::xoptional_assembly_baselayout() const

Return the layout_type of the container.

Return
layout_type of the container

auto xt::xoptional_assembly_basevalue()

Return an expression for the values of the optional assembly.

auto xt::xoptional_assembly_basevalue() const

Return a constant expression for the values of the optional assembly.

auto xt::xoptional_assembly_basehas_value()

Return an expression for the missing mask of the optional assembly.

auto xt::xoptional_assembly_basehas_value() const

Return a constant expression for the missing mask of the optional assembly.