# xfunctor_view

group Xt_xfunctor_view

  Chunked array container.

  Defined in `xtensor/xfunctor_view.hpp`

  template<class F, class CT>
  class xfunctor_view : public xt::xfunctor_applier_base<xfunctor_view<F, CT>>, public xt::xview_semantic<xfunctor_view<F, CT>>, public extension::xfunctor_view_base_t<F, CT>
    #include <xfunctor_view.hpp>

    View of an xexpression .

    The xt::xfunctor_view class is an expression addressing its elements by applying a functor to the corresponding element of an underlying expression. Unlike e.g. xgenerator, an xt::xfunctor_view is an lvalue. It is used e.g. to access real and imaginary parts of complex expressions.

    xt::xfunctor_view has a view semantics and can be used on any expression. For a similar feature with a container semantics, one can use xt::xfunctor_adaptor.

    xt::xfunctor_view is not meant to be used directly, but through helper functions such as xt::real or xt::imag.

    See also

    xt::real, xt::imag

    Template Parameters:

      - F – the functor type to be applied to the elements of specified expression.

      - CT – the closure type of the xt::xexpression type underlying this view

    Extended copy semantic

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

      The extended assignment operator.

    template<class E>
    inline disable_xexpression<E, self_type> &operator=(const E &e)
    template<class E>
    inline rebind_t<E> build_functor_view(E &&e) const

    Public Types

    using self_type = xfunctor_view<F, CT>
    using semantic_base = xview_semantic<self_type>
    template<class E>
    using rebind_t = xfunctor_view<F, E>

    Public Functions

    template<class E>
    self_type &operator=(const xexpression<E> &e)
    template<class E>
    disable_xexpression<E, self_type> &operator=(const E &e)
    template<class E>
    rebind_t<E> build_functor_view(E &&e) const
  template<class F, class CT>
  class xfunctor_adaptor : public xt::xfunctor_applier_base<xfunctor_adaptor<F, CT>>, public xt::xcontainer_semantic<xfunctor_adaptor<F, CT>>, public extension::xfunctor_view_base_t<F, CT>
    #include <xfunctor_view.hpp>

    Adapt a container with a functor, forwarding methods such as resize / reshape.

    xt::xfunctor_adaptor has a container semantics and can only be used with containers. For a similar feature with a view semantics, one can use xt::xfunctor_view.

    See also

    xt::xfunctor_view

    Template Parameters:

      - F – the functor type to be applied to the elements of specified expression.

      - CT – the closure type of the xt::xexpression type underlying this view

    Extended copy semantic

    template<class S = shape_type>
    auto resize(S &&shape, bool force = false)
    template<class S = shape_type>
    auto resize(S &&shape, layout_type l)
    template<class S = shape_type>
    auto resize(S &&shape, const strides_type &strides)
    template<class S = shape_type>
    auto &reshape(S &&shape, layout_type layout = base_type::static_layout) &
    template<class E>
    inline self_type &operator=(const xexpression<E> &e)

      The extended assignment operator.

    Public Types

    using self_type = xfunctor_adaptor<F, CT>
    using semantic_base = xcontainer_semantic<self_type>
    using xexpression_type = std::decay_t<CT>
    using base_type = xfunctor_applier_base<self_type>
    using shape_type = typename base_type::shape_type
    using strides_type = typename xexpression_type::strides_type

    Public Functions

    template<class E>
    self_type &operator=(const xexpression<E> &e)
    template<class E>
    disable_xexpression<E, self_type> &operator=(const E &e)

group Xt_xcomplex

  Defined in `xtensor/xcomplex.hpp`.

  Functions

  template<class E>
  inline decltype(auto) real(E &&e) noexcept

    Return an xt::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 xt::xexpression

  template<class E>
  inline decltype(auto) imag(E &&e) noexcept

    Return an xt::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 xt::xexpression

  template<class E>
  inline auto conj(E &&e) noexcept

    Return an xt::xfunction evaluating to the complex conjugate of the given expression.

    Parameters:

      e – the xt::xexpression

  template<class E>
  inline auto arg(E &&e) noexcept

    Calculates the phase angle (in radians) elementwise for the complex numbers in `e`.

    Parameters:

      e – the xt::xexpression

  template<class E>
  inline auto angle(E &&e, bool deg = false) noexcept

    Calculates the phase angle elementwise for the complex numbers in `e`.

    Note that this function might be slightly less performant than xt::arg.

    Parameters:

      - e – the xt::xexpression

      - deg – calculate angle in degrees instead of radians

  template<class E>
  inline auto norm(E &&e) noexcept

    Calculates the squared magnitude elementwise for the complex numbers in `e`.

    Equivalent to `xt::pow(xt::real(e), 2) + xt::pow(xt::imag(e), 2)`.

    Parameters:

      e – the xt::xexpression