xtensor
Loading...
Searching...
No Matches
xt::xfunctor_adaptor< F, CT > Class Template Reference

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

#include <xfunctor_view.hpp>

Inheritance diagram for xt::xfunctor_adaptor< F, CT >:
xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > > xt::xcontainer_semantic< xfunctor_adaptor< F, CT > > xt::xaccessible< xfunctor_adaptor< F, CT > > xt::xsemantic_base< xfunctor_adaptor< F, CT > >

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 Types inherited from xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > >
using self_type
using inner_types
using xexpression_type
using undecay_expression
using functor_type
using accessible_base
using extension_base
using expression_tag
using value_type
using reference
using const_reference
using pointer
using const_pointer
using size_type
using difference_type
using shape_type
using strides_type
using backstrides_type
using inner_shape_type
using inner_strides_type
using inner_backstrides_type
using bool_load_type
using stepper
using const_stepper
using layout_iterator
using const_layout_iterator
using reverse_layout_iterator
using const_reverse_layout_iterator
using broadcast_iterator
using const_broadcast_iterator
using reverse_broadcast_iterator
using const_reverse_broadcast_iterator
using linear_iterator
using const_linear_iterator
using reverse_linear_iterator
using const_reverse_linear_iterator
using iterator
using const_iterator
using reverse_iterator
using const_reverse_iterator
Public Types inherited from xt::xcontainer_semantic< xfunctor_adaptor< F, CT > >
using base_type
using derived_type
using temporary_type
Public Types inherited from xt::xsemantic_base< xfunctor_adaptor< F, CT > >
using base_type
using derived_type
using temporary_type

Public Member Functions

template<class E>
disable_xexpression< E, self_type > & operator= (const E &e)
Extended copy semantic
template<class E>
self_type & operator= (const xexpression< E > &e)
 The extended assignment operator.
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) &
Public Member Functions inherited from xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > >
reference at (Args... args)
 Returns a reference to the element at the specified position in the expression, after dimension and bounds checking.
const_reference at (Args... args) const
 Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.
disable_integral_t< S, reference > operator[] (const S &index)
 Returns a reference to the element at the specified position in the expression.
reference operator[] (std::initializer_list< I > index)
reference operator[] (size_type i)
disable_integral_t< S, const_reference > operator[] (const S &index) const
 Returns a constant reference to the element at the specified position in the expression.
const_reference operator[] (std::initializer_list< I > index) const
const_reference operator[] (size_type i) const
reference back ()
 Returns a reference to the last element of the expression.
const_reference back () const
 Returns a constant reference to last the element of the expression.
reference front ()
 Returns a reference to the first element of the expression.
const_reference front () const
 Returns a constant reference to first the element of the expression.
reference periodic (Args... args)
 Returns a reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and 'overflowing' indices are changed).
const_reference periodic (Args... args) const
 Returns a constant reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and 'overflowing' indices are changed).
auto data_element (size_type i) -> decltype(std::declval< FCT >()(std::declval< undecay_expression >().data_element(i)))
auto flat (size_type i) -> decltype(std::declval< FCT >()(std::declval< undecay_expression >().flat(i)))
auto load_simd (size_type i) const -> decltype(std::declval< FCT >().template proxy_simd_load< align, requested_type, N >(std::declval< undecay_expression >(), i))
auto store_simd (size_type i, const simd &e) -> decltype(std::declval< FCT >() .template proxy_simd_store< align >(std::declval< undecay_expression >(), i, e))
 xfunctor_applier_base (undecay_expression) noexcept
 Constructs an xfunctor_applier_base expression wrappering the specified xt::xexpression.
size_type size () const noexcept
 Returns the size of the expression.
const inner_shape_type & shape () const noexcept
 Returns the shape of the expression.
const inner_strides_type & strides () const noexcept
 Returns the strides of the expression.
const inner_backstrides_type & backstrides () const noexcept
 Returns the backstrides of the expression.
layout_type layout () const noexcept
 Returns the layout_type of the expression.
bool is_contiguous () const noexcept
reference operator() (Args... args)
 Returns a reference to the element at the specified position in the expression.
reference unchecked (Args... args)
 Returns a reference to the element at the specified position in the expression.
reference element (IT first, IT last)
 Returns a reference to the element at the specified position in the expression.
xexpression_type & expression () noexcept
 Returns a reference to the underlying expression of the view.
bool broadcast_shape (S &shape, bool reuse_cache=false) const
 Broadcast the shape of the function to the specified parameter.
bool has_linear_assign (const S &strides) const
 Checks whether the xfunctor_applier_base can be linearly assigned to an expression with the specified strides.
auto begin () noexcept
 Returns an iterator to the first element of the expression.
auto end () noexcept
 Returns an iterator to the element following the last element of the expression.
auto cbegin () const noexcept
 Returns a constant iterator to the first element of the expression.
auto cend () const noexcept
 Returns a constant iterator to the element following the last element of the expression.
auto rbegin () noexcept
 Returns an iterator to the first element of the reversed expression.
auto rend () noexcept
 Returns an iterator to the element following the last element of the reversed expression.
auto crbegin () const noexcept
 Returns a constant iterator to the first element of the reversed expression.
auto crend () const noexcept
 Returns a constant iterator to the element following the last element of the reversed expression.
linear_iterator linear_begin () noexcept
linear_iterator linear_end () noexcept
const_linear_iterator linear_cbegin () const noexcept
const_linear_iterator linear_cend () const noexcept
reverse_linear_iterator linear_rbegin () noexcept
reverse_linear_iterator linear_rend () noexcept
const_reverse_linear_iterator linear_crbegin () const noexcept
const_reverse_linear_iterator linear_crend () const noexcept
stepper stepper_begin (const S &shape) noexcept
stepper stepper_end (const S &shape, layout_type l) noexcept
Public Member Functions inherited from xt::xcontainer_semantic< xfunctor_adaptor< F, CT > >
derived_type & assign_temporary (temporary_type &&)
 Assigns the temporary tmp to *this.
derived_type & assign_xexpression (const xexpression< E > &e)
derived_type & computed_assign (const xexpression< E > &e)
derived_type & scalar_computed_assign (const E &e, F &&f)
Public Member Functions inherited from xt::xsemantic_base< xfunctor_adaptor< F, CT > >
disable_xexpression< E, derived_type & > operator+= (const E &)
 Adds the scalar e to *this.
disable_xexpression< E, derived_type & > operator-= (const E &)
 Subtracts the scalar e from *this.
disable_xexpression< E, derived_type & > operator*= (const E &)
 Multiplies *this with the scalar e.
disable_xexpression< E, derived_type & > operator/= (const E &)
 Divides *this by the scalar e.
disable_xexpression< E, derived_type & > operator%= (const E &)
 Computes the remainder of *this after division by the scalar e.
disable_xexpression< E, derived_type & > operator&= (const E &)
 Computes the bitwise and of *this and the scalar e and assigns it to *this.
disable_xexpression< E, derived_type & > operator|= (const E &)
 Computes the bitwise or of *this and the scalar e and assigns it to *this.
disable_xexpression< E, derived_type & > operator^= (const E &)
 Computes the bitwise xor of *this and the scalar e and assigns it to *this.
derived_type & assign (const xexpression< E > &)
 Assigns the xexpression e to *this.
derived_type & plus_assign (const xexpression< E > &)
 Adds the xexpression e to *this.
derived_type & minus_assign (const xexpression< E > &)
 Subtracts the xexpression e to *this.
derived_type & multiplies_assign (const xexpression< E > &)
 Multiplies *this with the xexpression e.
derived_type & divides_assign (const xexpression< E > &)
 Divides *this by the xexpression e.
derived_type & modulus_assign (const xexpression< E > &)
 Computes the remainder of *this after division by the xexpression e.
derived_type & bit_and_assign (const xexpression< E > &)
 Computes the bitwise and of e to *this.
derived_type & bit_or_assign (const xexpression< E > &)
 Computes the bitwise or of e to *this.
derived_type & bit_xor_assign (const xexpression< E > &)
 Computes the bitwise xor of e to *this.

Friends

class xcontainer_semantic< self_type >
class xaccessible< self_type >

Additional Inherited Members

Static Public Attributes inherited from xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > >
static constexpr layout_type static_layout
static constexpr bool contiguous_layout
Protected Member Functions inherited from xt::xcontainer_semantic< xfunctor_adaptor< F, CT > >
xcontainer_semantic & operator= (const xcontainer_semantic &)=default
Protected Member Functions inherited from xt::xsemantic_base< xfunctor_adaptor< F, CT > >
xsemantic_base & operator= (const xsemantic_base &)=default
Protected Attributes inherited from xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > >
undecay_expression m_e
functor_type m_functor

Detailed Description

template<class F, class CT>
class xt::xfunctor_adaptor< F, CT >

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.

Template Parameters
Fthe functor type to be applied to the elements of specified expression.
CTthe closure type of the xt::xexpression type underlying this view
See also
xt::xfunctor_view

Definition at line 509 of file xfunctor_view.hpp.

Member Typedef Documentation

◆ base_type

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::base_type = xfunctor_applier_base<self_type>

Definition at line 518 of file xfunctor_view.hpp.

◆ self_type

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::self_type = xfunctor_adaptor<F, CT>

Definition at line 515 of file xfunctor_view.hpp.

◆ semantic_base

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::semantic_base = xcontainer_semantic<self_type>

Definition at line 516 of file xfunctor_view.hpp.

◆ shape_type

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::shape_type = typename base_type::shape_type

Definition at line 519 of file xfunctor_view.hpp.

◆ strides_type

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::strides_type = typename xexpression_type::strides_type

Definition at line 520 of file xfunctor_view.hpp.

◆ xexpression_type

template<class F, class CT>
using xt::xfunctor_adaptor< F, CT >::xexpression_type = std::decay_t<CT>

Definition at line 517 of file xfunctor_view.hpp.

Member Function Documentation

◆ operator=()

template<class F, class CT>
template<class E>
auto xt::xfunctor_adaptor< F, CT >::operator= ( const xexpression< E > & e) -> self_type &
inline

The extended assignment operator.

Definition at line 1454 of file xfunctor_view.hpp.

◆ reshape()

template<class F, class CT>
template<class S>
auto & xt::xfunctor_adaptor< F, CT >::reshape ( S && shape,
layout_type layout = base_type::static_layout ) &

Definition at line 1497 of file xfunctor_view.hpp.

◆ resize() [1/3]

template<class F, class CT>
template<class S>
auto xt::xfunctor_adaptor< F, CT >::resize ( S && shape,
bool force = false )

Definition at line 1476 of file xfunctor_view.hpp.

◆ resize() [2/3]

template<class F, class CT>
template<class S>
auto xt::xfunctor_adaptor< F, CT >::resize ( S && shape,
const strides_type & strides )

Definition at line 1490 of file xfunctor_view.hpp.

◆ resize() [3/3]

template<class F, class CT>
template<class S>
auto xt::xfunctor_adaptor< F, CT >::resize ( S && shape,
layout_type l )

Definition at line 1483 of file xfunctor_view.hpp.

◆ xaccessible< self_type >

template<class F, class CT>
friend class xaccessible< self_type >
friend

Definition at line 545 of file xfunctor_view.hpp.

◆ xcontainer_semantic< self_type >

template<class F, class CT>
friend class xcontainer_semantic< self_type >
friend

Definition at line 545 of file xfunctor_view.hpp.


The documentation for this class was generated from the following file: