|
xtensor
|
Reducing function operating over specified axes. More...
#include <xreducer.hpp>
Public Types | |
| using | self_type = xreducer<F, CT, X, O> |
| using | inner_types = xcontainer_inner_types<self_type> |
| using | reduce_functor_type = typename inner_types::reduce_functor_type |
| using | init_functor_type = typename inner_types::init_functor_type |
| using | merge_functor_type = typename inner_types::merge_functor_type |
| using | xreducer_functors_type = xreducer_functors<reduce_functor_type, init_functor_type, merge_functor_type> |
| using | xexpression_type = typename inner_types::xexpression_type |
| using | axes_type = X |
| using | extension_base = extension::xreducer_base_t<F, CT, X, O> |
| using | expression_tag = typename extension_base::expression_tag |
| using | substepper_type = typename inner_types::substepper_type |
| using | value_type = typename inner_types::value_type |
| using | reference = typename inner_types::reference |
| using | const_reference = typename inner_types::const_reference |
| using | pointer = value_type* |
| using | const_pointer = const value_type* |
| using | size_type = typename inner_types::size_type |
| using | difference_type = typename xexpression_type::difference_type |
| using | iterable_base = xconst_iterable<self_type> |
| using | inner_shape_type = typename iterable_base::inner_shape_type |
| using | shape_type = inner_shape_type |
| using | dim_mapping_type = typename select_dim_mapping_type<inner_shape_type>::type |
| using | stepper = typename iterable_base::stepper |
| using | const_stepper = typename iterable_base::const_stepper |
| using | bool_load_type = typename xexpression_type::bool_load_type |
| template<class E, class Func = F, class Opts = O> | |
| using | rebind_t = xreducer<Func, E, X, Opts> |
| Public Types inherited from xt::xexpression< xreducer< F, CT, X, O > > | |
| using | derived_type |
| Public Types inherited from xt::xconst_iterable< xreducer< F, CT, X, O > > | |
| using | derived_type |
| using | iterable_types |
| using | inner_shape_type |
| using | stepper |
| using | const_stepper |
| using | layout_iterator |
| using | const_layout_iterator |
| using | reverse_layout_iterator |
| using | const_reverse_layout_iterator |
| using | linear_iterator |
| using | const_linear_iterator |
| using | reverse_linear_iterator |
| using | const_reverse_linear_iterator |
| using | broadcast_iterator |
| using | const_broadcast_iterator |
| using | reverse_broadcast_iterator |
| using | const_reverse_broadcast_iterator |
| using | iterator |
| using | const_iterator |
| using | reverse_iterator |
| using | const_reverse_iterator |
| Public Types inherited from xt::xaccessible< xreducer< F, CT, X, O > > | |
| using | base_type |
| using | derived_type |
| using | reference |
| using | size_type |
| Public Types inherited from xt::xconst_accessible< xreducer< F, CT, X, O > > | |
| using | derived_type |
| using | inner_types |
| using | reference |
| using | const_reference |
| using | size_type |
Public Member Functions | |
| xreducer_functors_type | functors () const |
| const O & | options () const |
Constructor | |
| template<class Func, class CTA, class AX, class OX> | |
| xreducer (Func &&func, CTA &&e, AX &&axes, OX &&options) | |
| Constructs an xreducer expression applying the specified function to the given expression over the given axes. | |
Size and shape | |
| const inner_shape_type & | shape () const noexcept |
| Returns the shape of the expression. | |
| layout_type | layout () const noexcept |
| Returns the shape of the expression. | |
| bool | is_contiguous () const noexcept |
Data | |
| template<class... Args> | |
| const_reference | operator() (Args... args) const |
| Returns a constant reference to the element at the specified position in the reducer. | |
| template<class... Args> | |
| const_reference | unchecked (Args... args) const |
| Returns a constant reference to the element at the specified position in the reducer. | |
| template<class It> | |
| const_reference | element (It first, It last) const |
| Returns a constant reference to the element at the specified position in the reducer. | |
| const xexpression_type & | expression () const noexcept |
| Returns a constant reference to the underlying expression of the reducer. | |
Broadcasting | |
| template<class S> | |
| bool | broadcast_shape (S &shape, bool reuse_cache=false) const |
| Broadcast the shape of the reducer to the specified parameter. | |
| template<class S> | |
| bool | has_linear_assign (const S &strides) const noexcept |
| Checks whether the xreducer can be linearly assigned to an expression with the specified strides. | |
| template<class S> | |
| const_stepper | stepper_begin (const S &shape) const noexcept |
| template<class S> | |
| const_stepper | stepper_end (const S &shape, layout_type) const noexcept |
| template<class E> | |
| rebind_t< E > | build_reducer (E &&e) const |
| template<class E, class Func, class Opts> | |
| rebind_t< E, Func, Opts > | build_reducer (E &&e, Func &&func, Opts &&opts) const |
| Public Member Functions inherited from xt::xexpression< xreducer< F, CT, X, O > > | |
| derived_type & | derived_cast () &noexcept |
| Returns a reference to the actual derived type of the xexpression. | |
| Public Member Functions inherited from xt::xconst_iterable< xreducer< F, CT, X, O > > | |
| const_layout_iterator< L > | begin () const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_layout_iterator< L > | end () const noexcept |
| Returns a constant iterator to the element following the last element of the expression. | |
| const_layout_iterator< L > | cbegin () const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_layout_iterator< L > | cend () const noexcept |
| Returns a constant iterator to the element following the last element of the expression. | |
| const_reverse_layout_iterator< L > | rbegin () const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_layout_iterator< L > | rend () const noexcept |
| Returns a constant iterator to the element following the last element of the reversed expression. | |
| const_reverse_layout_iterator< L > | crbegin () const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_layout_iterator< L > | crend () const noexcept |
| Returns a constant iterator to the element following the last element of the reversed expression. | |
| Public Member Functions inherited from xt::xaccessible< xreducer< F, CT, X, O > > | |
| 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, 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 |
| const_reference | back () const |
| Returns a constant reference to last the element of the expression. | |
| const_reference | front () const |
| Returns a constant reference to first the element of the expression. | |
| 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). | |
| Public Member Functions inherited from xt::xconst_accessible< xreducer< F, CT, X, O > > | |
| size_type | size () const noexcept(noexcept(derived_cast().shape())) |
| Returns the size of the expression. | |
| size_type | dimension () const noexcept |
| Returns the number of dimensions of the expression. | |
| size_type | shape (size_type index) const |
| Returns the i-th dimension of the expression. | |
| 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, const_reference > | operator[] (const S &index) const |
| Returns a constant reference to the element at the specified position in the expression. | |
| 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). | |
| bool | in_bounds (Args... args) const |
| Returns true only if the the specified position is a valid entry in the expression. | |
| const_reference | front () const |
| Returns a constant reference to first the element of the expression. | |
| const_reference | back () const |
| Returns a constant reference to last the element of the expression. | |
Static Public Attributes | |
| static constexpr layout_type | static_layout = layout_type::dynamic |
| static constexpr bool | contiguous_layout = false |
Friends | |
| class | xreducer_stepper< F, CT, X, O > |
Additional Inherited Members | |
| Protected Member Functions inherited from xt::xsharable_expression< xreducer< F, CT, X, O > > | |
| xsharable_expression & | operator= (const xsharable_expression &)=default |
| Protected Member Functions inherited from xt::xexpression< xreducer< F, CT, X, O > > | |
| xexpression & | operator= (const xexpression &)=default |
| const inner_shape_type & | get_shape () const |
| Protected Member Functions inherited from xt::xaccessible< xreducer< F, CT, X, O > > | |
| xaccessible & | operator= (const xaccessible &)=default |
| Protected Member Functions inherited from xt::xconst_accessible< xreducer< F, CT, X, O > > | |
| xconst_accessible & | operator= (const xconst_accessible &)=default |
Reducing function operating over specified axes.
The xreducer class implements an xexpression applying a reducing function to an xexpression over the specified axes.
| F | a tuple of functors (class xreducer_functors or compatible) |
| CT | the closure type of the xexpression to reduce |
| X | the list of axes |
The reducer's result_type is deduced from the result type of function F::reduce_functor_type when called with elements of the expression
| CT. |
Definition at line 804 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::axes_type = X |
Definition at line 820 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::bool_load_type = typename xexpression_type::bool_load_type |
Definition at line 843 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::const_pointer = const value_type* |
Definition at line 830 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::const_reference = typename inner_types::const_reference |
Definition at line 828 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::const_stepper = typename iterable_base::const_stepper |
Definition at line 842 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::difference_type = typename xexpression_type::difference_type |
Definition at line 833 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::dim_mapping_type = typename select_dim_mapping_type<inner_shape_type>::type |
Definition at line 839 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::expression_tag = typename extension_base::expression_tag |
Definition at line 823 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::extension_base = extension::xreducer_base_t<F, CT, X, O> |
Definition at line 822 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::init_functor_type = typename inner_types::init_functor_type |
Definition at line 815 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::inner_shape_type = typename iterable_base::inner_shape_type |
Definition at line 836 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::inner_types = xcontainer_inner_types<self_type> |
Definition at line 812 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::iterable_base = xconst_iterable<self_type> |
Definition at line 835 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::merge_functor_type = typename inner_types::merge_functor_type |
Definition at line 816 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::pointer = value_type* |
Definition at line 829 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::rebind_t = xreducer<Func, E, X, Opts> |
Definition at line 877 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::reduce_functor_type = typename inner_types::reduce_functor_type |
Definition at line 814 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::reference = typename inner_types::reference |
Definition at line 827 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::self_type = xreducer<F, CT, X, O> |
Definition at line 811 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::shape_type = inner_shape_type |
Definition at line 837 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::size_type = typename inner_types::size_type |
Definition at line 832 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::stepper = typename iterable_base::stepper |
Definition at line 841 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::substepper_type = typename inner_types::substepper_type |
Definition at line 825 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::value_type = typename inner_types::value_type |
Definition at line 826 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::xexpression_type = typename inner_types::xexpression_type |
Definition at line 819 of file xreducer.hpp.
| using xt::xreducer< F, CT, X, O >::xreducer_functors_type = xreducer_functors<reduce_functor_type, init_functor_type, merge_functor_type> |
Definition at line 817 of file xreducer.hpp.
|
inline |
Constructs an xreducer expression applying the specified function to the given expression over the given axes.
| func | the function to apply |
| e | the expression to reduce |
| axes | the axes along which the reduction is performed |
| options | reducer options controlling evaluation strategy and related settings |
Definition at line 1406 of file xreducer.hpp.
|
inline |
Broadcast the shape of the reducer to the specified parameter.
| shape | the result shape |
| reuse_cache | parameter for internal optimization |
Definition at line 1601 of file xreducer.hpp.
|
inline |
Definition at line 1639 of file xreducer.hpp.
|
inline |
Definition at line 1651 of file xreducer.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the reducer.
| 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 reducer. |
Definition at line 1552 of file xreducer.hpp.
|
inlinenoexcept |
Returns a constant reference to the underlying expression of the reducer.
Definition at line 1582 of file xreducer.hpp.
|
inline |
Definition at line 885 of file xreducer.hpp.
|
inlinenoexcept |
Checks whether the xreducer can be linearly assigned to an expression with the specified strides.
Definition at line 1613 of file xreducer.hpp.
|
inlinenoexcept |
Definition at line 1489 of file xreducer.hpp.
|
inlinenoexcept |
Returns the shape of the expression.
Definition at line 1483 of file xreducer.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the reducer.
| args | a list of indices specifying the position in the reducer. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the reducer. |
Definition at line 1508 of file xreducer.hpp.
|
inline |
Definition at line 892 of file xreducer.hpp.
|
inlinenoexcept |
Returns the shape of the expression.
Definition at line 1474 of file xreducer.hpp.
|
inlinenoexcept |
Definition at line 1622 of file xreducer.hpp.
|
inlinenoexcept |
Definition at line 1630 of file xreducer.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the reducer.
| args | a list of indices specifying the position in the reducer. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the reducer, else the behavior is undefined. |
Definition at line 1537 of file xreducer.hpp.
|
friend |
Definition at line 906 of file xreducer.hpp.
|
staticconstexpr |
Definition at line 846 of file xreducer.hpp.
|
staticconstexpr |
Definition at line 845 of file xreducer.hpp.