xfunctorview¶
Defined in xtensor/xfunctorview.hpp
- template <class F, class CT>
-
class
xt::
xfunctorview
¶ View of an xexpression .
The xfunctorview class is an expression addressing its elements by applying a functor to the corresponding element of an underlying expression. Unlike e.g. xgenerator, an xfunctorview is an lvalue. It is used e.g. to access real and imaginary parts of complex expressions. expressions. xfunctorview is not meant to be used directly, but through helper functions such as real or imag.
- See
- real, imag
- Template Parameters
F
: the functor type to be applied to the elements of specified expression.CT
: the closure type of the xexpression type underlying this view
Inherits from xt::xview_semantic< xfunctorview< F, CT > >
Extended copy semantic
- template <class E>
-
auto
operator=
(const xexpression<E> &e)¶ The extended assignment operator.
Constructor
-
xfunctorview
(CT e)¶ Constructs an xfunctorview expression wrappering the specified xexpression.
- Parameters
e
: the underlying expression
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)¶ Returns a 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.
-
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)¶ Returns a 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)¶ Returns a reference to the element at the specified position in the expression.
- Parameters
first
: iterator starting the sequence of indiceslast
: 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.
- 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 indiceslast
: 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
Defined in xtensor/xcomplex.hpp
- 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 whethere
is an lvalue or an rvalue.- Template Parameters
e
: the xexpression
- 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 whethere
is an lvalue or an rvalue.- Template Parameters
e
: the xexpression