# 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 > >

  Constructors

  `xfunctorview`(CT e)

    Constructs an xfunctorview expression wrappering the specified xexpression.

    Parameters
      - `e`: the underlying expression
  template <class Func, class E>
  `xfunctorview`(Func &&func, E &&e)

    Constructs an xfunctorview expression wrappering the specified xexpression.

    Parameters
      - `func`: the functor to be applied to the elements of the underlying expression.
      - `e`: the underlying expression

  Extended copy semantic

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

    The extended assignment operator.

  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.

  layout_type `layout`() const

    Returns the layout_type 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 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 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 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 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.

  Reverse Iterators

  auto `rbegin`()

    Returns an iterator to the first element of the reversed expression.

  auto `rend`()

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

  auto `rbegin`() const

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

  auto `rend`() const

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

  auto `crbegin`() const

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

  auto `crend`() const

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

  Broadcast iterators

  template <layout_type L>
  auto `xbegin`()

    Returns an iterator to the first element of the expression.

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xend`()

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xbegin`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xend`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `cxbegin`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `cxend`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  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 Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.

  Reverse broadcast iterators

  template <layout_type L>
  auto `xrbegin`()

    Returns an iterator to the first element of the reversed expression.

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xrend`()

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xrbegin`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `xrend`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `cxrbegin`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <layout_type L>
  auto `cxrend`() const

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

    Template Parameters
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `xrbegin`(const S &shape)

    Returns an iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `xrend`(const S &shape)

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

    The iteration is broadcasted to the specified shape.

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `xrbegin`(const S &shape) const

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

    The iteration is broadcasted to the specified shape.

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `xrend`(const S &shape) const

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

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `cxrbegin`(const S &shape) const

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

    The iteration is broadcasted to the specified shape.

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.
  template <class S, layout_type L>
  auto `cxrend`(const S &shape) const

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

    Parameters
      - `shape`: the shape used for broadcasting
    Template Parameters
      - `S`: type of the `shape` parameter.
      - `L`: layout used for the traversal. Default value is `DEFAULT_LAYOUT`.

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 whether `e` 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 whether `e` is an lvalue or an rvalue.

  Template Parameters
    - `e`: the xexpression