xoffsetview

template <class CT, class M, std::size_t I>
class xt::xoffsetview

View of an xexpression .

The xoffsetview class is an expression addressing a specified attribute of objects contained in another expression. xoffsetview is used e.g. to access real and imaginary parts of complex expressions. xoffsetview is not meant to be used directly, but through helper functions such as real or imag.

See
real, imag
Template Parameters
  • CT: the closure type of the xexpression type underlying this view
  • M: the type members of the contained objects
  • I: the offset of the addressed member in the memory layout of the contained object.

Inherits from xt::xview_semantic< xoffsetview< CT, M, I > >

Extended copy semantic

template <class E>
auto operator=(const xexpression<E> &e)

The extended assignment operator.

Constructor

xoffsetview(CT e)

Constructs an xoffsetview expression wrappering the specified xexpression.

Parameters
  • e: the expression to broadcast
  • s: the shape to apply

Size and shape

auto size() const

Returns the size of the expression.

auto dimension() const

Returns the number of dimensions of the expression.

auto shape() const

Returns the shape of the expression.

Data

auto operator[](const xindex &index) const

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

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

template <class... Args>
auto operator()(Args... args) const

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

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

template <class It>
auto element(It first, It last) const

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

Parameters
  • first: iterator starting the sequence of indices
  • last: iterator ending the sequence of indices The number of indices in the squence should be equal to or greater than the number of dimensions of the function.

Broadcasting

template <class S>
bool broadcast_shape(S &shape) const

Broadcast the shape of the function to the specified parameter.

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

template <class S>
bool is_trivial_broadcast(const S &strides) const

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

Return
a boolean indicating whether the broadcasting is trivial

Iterators

auto begin()

Returns an iterator to the first element of the expression.

auto end()

Returns an iterator to the element following the last element of the expression.

auto begin() const

Returns a constant iterator to the first element of the expression.

auto end() const

Returns a constant iterator to the element following the last element of the expression.

auto cbegin() const

Returns a constant iterator to the first element of the expression.

auto cend() const

Returns a constant iterator to the element following the last element of the expression.

auto xbegin()

Returns an iterator to the first element of the expression.

auto xend()

Returns an iterator to the element following the last element of the expression.

auto xbegin() const

Returns a constant iterator to the first element of the expression.

auto xend() const

Returns a constant iterator to the element following the last element of the expression.

auto cxbegin() const

Returns a constant iterator to the first element of the expression.

auto cxend() const

Returns a constant iterator to the element following the last element of the expression.

template <class S>
auto xbegin(const S &shape)

Returns a constant iterator to the first element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class S>
auto xend(const S &shape)

Returns a constant iterator to the element following the last element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class S>
auto xbegin(const S &shape) const

Returns a constant iterator to the first element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class S>
auto xend(const S &shape) const

Returns a constant iterator to the element following the last element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class S>
auto cxbegin(const S &shape) const

Returns a constant iterator to the first element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class S>
auto cxend(const S &shape) const

Returns a constant iterator to the element following the last element of the expression.

The iteration is broadcasted to the specified shape.

Parameters
  • shape: the shape used for broadcasting

template <class E>
decltype(auto) xt::real(E && e)

Returns an xexpression representing the real part of the given expression.

The returned expression either hold a const reference to e or a copy depending on whether e is an lvalue or an rvalue.

Template Parameters

template <class E>
decltype(auto) xt::imag(E && e)

Returns an xexpression representing the imaginary part of the given expression.

The returned expression either hold a const reference to e or a copy depending on whether e is an lvalue or an rvalue.

Template Parameters