xtensor
|
Reducing function operating over specified axes. More...
#include <xreducer.hpp>
Public Member Functions | |
template<class... Args> | |
const_reference | operator() (Args... args) const |
template<class... Args> | |
const_reference | unchecked (Args... args) const |
template<class It > | |
const_reference | element (It first, It last) const |
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 |
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 | |
const xexpression_type & | expression () const noexcept |
Returns a constant reference to the underlying expression of the reducer. | |
template<class... Args> | |
auto | operator() (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the reducer. | |
template<class... Args> | |
auto | unchecked (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the reducer. | |
template<class It > | |
auto | element (It first, It last) const -> const_reference |
Returns a constant reference to the element at the specified position in 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 > | |
auto | stepper_begin (const S &shape) const noexcept -> const_stepper |
template<class S > | |
auto | stepper_end (const S &shape, layout_type l) const noexcept -> const_stepper |
template<class E > | |
auto | build_reducer (E &&e) const -> rebind_t< E > |
template<class E , class Func , class Opts > | |
auto | build_reducer (E &&e, Func &&func, Opts &&opts) const -> rebind_t< E, Func, Opts > |
Public Member Functions inherited from xt::xexpression< D > | |
derived_type & | derived_cast () &noexcept |
Returns a reference to the actual derived type of the xexpression. | |
const derived_type & | derived_cast () const &noexcept |
Returns a constant reference to the actual derived type of the xexpression. | |
derived_type | derived_cast () &&noexcept |
Returns a constant 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 |
const_broadcast_iterator< S, L > | begin (const S &shape) const noexcept |
const_layout_iterator< L > | end () const noexcept |
const_broadcast_iterator< S, L > | end (const S &shape) const noexcept |
const_layout_iterator< L > | cbegin () const noexcept |
const_broadcast_iterator< S, L > | cbegin (const S &shape) const noexcept |
const_layout_iterator< L > | cend () const noexcept |
const_broadcast_iterator< S, L > | cend (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | rbegin () const noexcept |
const_reverse_broadcast_iterator< S, L > | rbegin (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | rend () const noexcept |
const_reverse_broadcast_iterator< S, L > | rend (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | crbegin () const noexcept |
const_reverse_broadcast_iterator< S, L > | crbegin (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | crend () const noexcept |
const_reverse_broadcast_iterator< S, L > | crend (const S &shape) const noexcept |
auto | begin () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the first element of the expression. | |
auto | end () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | cbegin () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the first element of the expression. | |
auto | cend () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | begin (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the expression. | |
auto | end (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | cbegin (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the expression. | |
auto | cend (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | rbegin () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | rend () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | crbegin () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | crend () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | rbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | rend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | crbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | crend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | get_cbegin (bool end_index) const noexcept -> const_layout_iterator< L > |
auto | get_cbegin (const S &shape, bool end_index) const noexcept -> const_broadcast_iterator< S, L > |
auto | get_cend (bool end_index) const noexcept -> const_layout_iterator< L > |
auto | get_cend (const S &shape, bool end_index) const noexcept -> const_broadcast_iterator< S, L > |
auto | get_stepper_begin (const S &shape) const noexcept -> const_stepper |
auto | get_stepper_end (const S &shape, layout_type l) const noexcept -> const_stepper |
Public Member Functions inherited from xt::xaccessible< xreducer< F, CT, X, O > > | |
reference | at (Args... args) |
auto | at (Args... args) -> reference |
Returns a reference to the element at the specified position in the expression, after dimension and bounds checking. | |
const_reference | at (Args... args) const |
auto | at (Args... args) const -> const_reference |
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) |
reference | operator[] (std::initializer_list< I > index) |
reference | operator[] (size_type i) |
auto | operator[] (const S &index) -> disable_integral_t< S, reference > |
Returns a reference to the element at the specified position in the expression. | |
auto | operator[] (std::initializer_list< I > index) -> reference |
reference | periodic (Args... args) |
auto | periodic (Args... args) -> reference |
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 |
auto | periodic (Args... args) const -> const_reference |
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). | |
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 | 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. | |
Public Member Functions inherited from xt::xconst_accessible< D > | |
size_type | size () const noexcept |
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. | |
template<class... Args> | |
const_reference | at (Args... args) const |
template<class S > | |
disable_integral_t< S, const_reference > | operator[] (const S &index) const |
template<class I > | |
const_reference | operator[] (std::initializer_list< I > index) const |
const_reference | operator[] (size_type i) const |
template<class... Args> | |
const_reference | periodic (Args... args) const |
template<class... Args> | |
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. | |
template<class... Args> | |
auto | at (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking. | |
template<class S > | |
auto | operator[] (const S &index) const -> disable_integral_t< S, const_reference > |
Returns a constant reference to the element at the specified position in the expression. | |
template<class I > | |
auto | operator[] (std::initializer_list< I > index) const -> const_reference |
template<class... Args> | |
auto | periodic (Args... args) const -> const_reference |
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). | |
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 > |
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 813 of file xreducer.hpp.
Definition at line 829 of file xreducer.hpp.
Definition at line 852 of file xreducer.hpp.
Definition at line 839 of file xreducer.hpp.
Definition at line 837 of file xreducer.hpp.
Definition at line 851 of file xreducer.hpp.
Definition at line 842 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 848 of file xreducer.hpp.
Definition at line 832 of file xreducer.hpp.
Definition at line 831 of file xreducer.hpp.
using xt::xreducer< F, CT, X, O >::init_functor_type = typename inner_types::init_functor_type |
Definition at line 824 of file xreducer.hpp.
Definition at line 845 of file xreducer.hpp.
using xt::xreducer< F, CT, X, O >::inner_types = xcontainer_inner_types<self_type> |
Definition at line 821 of file xreducer.hpp.
using xt::xreducer< F, CT, X, O >::iterable_base = xconst_iterable<self_type> |
Definition at line 844 of file xreducer.hpp.
Definition at line 825 of file xreducer.hpp.
Definition at line 838 of file xreducer.hpp.
Definition at line 886 of file xreducer.hpp.
Definition at line 823 of file xreducer.hpp.
Definition at line 836 of file xreducer.hpp.
Definition at line 820 of file xreducer.hpp.
Definition at line 846 of file xreducer.hpp.
Definition at line 841 of file xreducer.hpp.
Definition at line 850 of file xreducer.hpp.
Definition at line 834 of file xreducer.hpp.
Definition at line 835 of file xreducer.hpp.
Definition at line 828 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 826 of file xreducer.hpp.
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 |
Definition at line 1414 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 1609 of file xreducer.hpp.
|
inline |
Definition at line 1647 of file xreducer.hpp.
|
inline |
Definition at line 1659 of file xreducer.hpp.
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 1560 of file xreducer.hpp.
Returns a constant reference to the underlying expression of the reducer.
Definition at line 1590 of file xreducer.hpp.
|
inline |
Definition at line 894 of file xreducer.hpp.
Checks whether the xreducer can be linearly assigned to an expression with the specified strides.
Definition at line 1621 of file xreducer.hpp.
Definition at line 1497 of file xreducer.hpp.
|
inlinenoexcept |
Returns the shape of the expression.
Definition at line 1491 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 1516 of file xreducer.hpp.
Definition at line 901 of file xreducer.hpp.
Returns the shape of the expression.
Definition at line 1482 of file xreducer.hpp.
|
inlinenoexcept |
Definition at line 1630 of file xreducer.hpp.
|
inlinenoexcept |
Definition at line 1638 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 1545 of file xreducer.hpp.
Definition at line 915 of file xreducer.hpp.
Definition at line 855 of file xreducer.hpp.
|
staticconstexpr |
Definition at line 854 of file xreducer.hpp.