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

Reducing function operating over specified axes. More...

#include <xreducer.hpp>

Inheritance diagram for xt::xreducer< F, CT, X, O >:
xt::xsharable_expression< xreducer< F, CT, X, O > > xt::xconst_iterable< xreducer< F, CT, X, O > > xt::xaccessible< xreducer< F, CT, X, O > > xt::xexpression< D > xt::xconst_accessible< D >

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< D >
using derived_type = D
 
- 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< D >
using derived_type = D
 
using inner_types = xcontainer_inner_types<D>
 
using reference = typename inner_types::reference
 
using const_reference = typename inner_types::const_reference
 
using size_type = typename inner_types::size_type
 

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, Optsbuild_reducer (E &&e, Func &&func, Opts &&opts) const
 
xreducer_functors_type functors () const
 
const Ooptions () 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_typederived_cast () &noexcept
 Returns a reference to the actual derived type of the xexpression.
 
const derived_typederived_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< Lbegin () const noexcept
 
const_broadcast_iterator< S, Lbegin (const S &shape) const noexcept
 
const_layout_iterator< Lend () const noexcept
 
const_broadcast_iterator< S, Lend (const S &shape) const noexcept
 
const_layout_iterator< Lcbegin () const noexcept
 
const_broadcast_iterator< S, Lcbegin (const S &shape) const noexcept
 
const_layout_iterator< Lcend () const noexcept
 
const_broadcast_iterator< S, Lcend (const S &shape) const noexcept
 
const_reverse_layout_iterator< Lrbegin () const noexcept
 
const_reverse_broadcast_iterator< S, Lrbegin (const S &shape) const noexcept
 
const_reverse_layout_iterator< Lrend () const noexcept
 
const_reverse_broadcast_iterator< S, Lrend (const S &shape) const noexcept
 
const_reverse_layout_iterator< Lcrbegin () const noexcept
 
const_reverse_broadcast_iterator< S, Lcrbegin (const S &shape) const noexcept
 
const_reverse_layout_iterator< Lcrend () const noexcept
 
const_reverse_broadcast_iterator< S, Lcrend (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 >
 

Additional Inherited Members

- Protected Member Functions inherited from xt::xsharable_expression< xreducer< F, CT, X, O > >
 xsharable_expression (const xsharable_expression &)=default
 
 xsharable_expression (xsharable_expression &&)=default
 
xsharable_expressionoperator= (const xsharable_expression &)=default
 
xsharable_expressionoperator= (xsharable_expression &&)=default
 
- Protected Member Functions inherited from xt::xexpression< D >
 xexpression (const xexpression &)=default
 
xexpressionoperator= (const xexpression &)=default
 
 xexpression (xexpression &&)=default
 
xexpressionoperator= (xexpression &&)=default
 
- Protected Member Functions inherited from xt::xconst_iterable< xreducer< F, CT, X, O > >
const inner_shape_type & get_shape () const
 
- Protected Member Functions inherited from xt::xaccessible< xreducer< F, CT, X, O > >
 xaccessible (const xaccessible &)=default
 
 xaccessible (xaccessible &&)=default
 
xaccessibleoperator= (const xaccessible &)=default
 
xaccessibleoperator= (xaccessible &&)=default
 
- Protected Member Functions inherited from xt::xconst_accessible< D >
 xconst_accessible (const xconst_accessible &)=default
 
xconst_accessibleoperator= (const xconst_accessible &)=default
 
 xconst_accessible (xconst_accessible &&)=default
 
xconst_accessibleoperator= (xconst_accessible &&)=default
 

Detailed Description

template<class F, class CT, class X, class O>
class xt::xreducer< 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.

Template Parameters
Fa tuple of functors (class xreducer_functors or compatible)
CTthe closure type of the xexpression to reduce
Xthe 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

Template Parameters
CT.
See also
reduce

Definition at line 813 of file xreducer.hpp.

Member Typedef Documentation

◆ axes_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::axes_type = X

Definition at line 829 of file xreducer.hpp.

◆ bool_load_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::bool_load_type = typename xexpression_type::bool_load_type

Definition at line 852 of file xreducer.hpp.

◆ const_pointer

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::const_pointer = const value_type*

Definition at line 839 of file xreducer.hpp.

◆ const_reference

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::const_reference = typename inner_types::const_reference

Definition at line 837 of file xreducer.hpp.

◆ const_stepper

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::const_stepper = typename iterable_base::const_stepper

Definition at line 851 of file xreducer.hpp.

◆ difference_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::difference_type = typename xexpression_type::difference_type

Definition at line 842 of file xreducer.hpp.

◆ dim_mapping_type

template<class F , class CT , class X , class O >
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.

◆ expression_tag

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::expression_tag = typename extension_base::expression_tag

Definition at line 832 of file xreducer.hpp.

◆ extension_base

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::extension_base = extension::xreducer_base_t<F, CT, X, O>

Definition at line 831 of file xreducer.hpp.

◆ init_functor_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::init_functor_type = typename inner_types::init_functor_type

Definition at line 824 of file xreducer.hpp.

◆ inner_shape_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::inner_shape_type = typename iterable_base::inner_shape_type

Definition at line 845 of file xreducer.hpp.

◆ inner_types

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::inner_types = xcontainer_inner_types<self_type>

Definition at line 821 of file xreducer.hpp.

◆ iterable_base

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::iterable_base = xconst_iterable<self_type>

Definition at line 844 of file xreducer.hpp.

◆ merge_functor_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::merge_functor_type = typename inner_types::merge_functor_type

Definition at line 825 of file xreducer.hpp.

◆ pointer

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::pointer = value_type*

Definition at line 838 of file xreducer.hpp.

◆ rebind_t

template<class F , class CT , class X , class O >
template<class E , class Func = F, class Opts = O>
using xt::xreducer< F, CT, X, O >::rebind_t = xreducer<Func, E, X, Opts>

Definition at line 886 of file xreducer.hpp.

◆ reduce_functor_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::reduce_functor_type = typename inner_types::reduce_functor_type

Definition at line 823 of file xreducer.hpp.

◆ reference

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::reference = typename inner_types::reference

Definition at line 836 of file xreducer.hpp.

◆ self_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::self_type = xreducer<F, CT, X, O>

Definition at line 820 of file xreducer.hpp.

◆ shape_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::shape_type = inner_shape_type

Definition at line 846 of file xreducer.hpp.

◆ size_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::size_type = typename inner_types::size_type

Definition at line 841 of file xreducer.hpp.

◆ stepper

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::stepper = typename iterable_base::stepper

Definition at line 850 of file xreducer.hpp.

◆ substepper_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::substepper_type = typename inner_types::substepper_type

Definition at line 834 of file xreducer.hpp.

◆ value_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::value_type = typename inner_types::value_type

Definition at line 835 of file xreducer.hpp.

◆ xexpression_type

template<class F , class CT , class X , class O >
using xt::xreducer< F, CT, X, O >::xexpression_type = typename inner_types::xexpression_type

Definition at line 828 of file xreducer.hpp.

◆ xreducer_functors_type

template<class F , class CT , class X , class O >
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.

Constructor & Destructor Documentation

◆ xreducer()

template<class F , class CT , class X , class O >
template<class Func , class CTA , class AX , class OX >
xt::xreducer< F, CT, X, O >::xreducer ( Func && func,
CTA && e,
AX && axes,
OX && options )
inline

Constructs an xreducer expression applying the specified function to the given expression over the given axes.

Parameters
functhe function to apply
ethe expression to reduce
axesthe axes along which the reduction is performed

Definition at line 1414 of file xreducer.hpp.

Member Function Documentation

◆ broadcast_shape()

template<class F , class CT , class X , class O >
template<class S >
bool xt::xreducer< F, CT, X, O >::broadcast_shape ( S & shape,
bool reuse_cache = false ) const
inline

Broadcast the shape of the reducer to the specified parameter.

Parameters
shapethe result shape
reuse_cacheparameter for internal optimization
Returns
a boolean indicating whether the broadcasting is trivial

Definition at line 1609 of file xreducer.hpp.

◆ build_reducer() [1/2]

template<class F , class CT , class X , class O >
template<class E >
auto xt::xreducer< F, CT, X, O >::build_reducer ( E && e) const -> rebind_t<E>
inline

Definition at line 1647 of file xreducer.hpp.

◆ build_reducer() [2/2]

template<class F , class CT , class X , class O >
template<class E , class Func , class Opts >
auto xt::xreducer< F, CT, X, O >::build_reducer ( E && e,
Func && func,
Opts && opts ) const -> rebind_t<E, Func, Opts>
inline

Definition at line 1659 of file xreducer.hpp.

◆ element()

template<class F , class CT , class X , class O >
template<class It >
auto xt::xreducer< F, CT, X, O >::element ( It first,
It last ) const -> const_reference
inline

Returns a constant reference to the element at the specified position in the reducer.

Parameters
firstiterator starting the sequence of indices
lastiterator 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.

◆ expression()

template<class F , class CT , class X , class O >
auto xt::xreducer< F, CT, X, O >::expression ( ) const
inlinenoexcept

Returns a constant reference to the underlying expression of the reducer.

Definition at line 1590 of file xreducer.hpp.

◆ functors()

template<class F , class CT , class X , class O >
xreducer_functors_type xt::xreducer< F, CT, X, O >::functors ( ) const
inline

Definition at line 894 of file xreducer.hpp.

◆ has_linear_assign()

template<class F , class CT , class X , class O >
template<class S >
bool xt::xreducer< F, CT, X, O >::has_linear_assign ( const S & strides) const
inlinenoexcept

Checks whether the xreducer can be linearly assigned to an expression with the specified strides.

Returns
a boolean indicating whether a linear assign is possible

Definition at line 1621 of file xreducer.hpp.

◆ is_contiguous()

template<class F , class CT , class X , class O >
bool xt::xreducer< F, CT, X, O >::is_contiguous ( ) const
inlinenoexcept

Definition at line 1497 of file xreducer.hpp.

◆ layout()

template<class F , class CT , class X , class O >
layout_type xt::xreducer< F, CT, X, O >::layout ( ) const
inlinenoexcept

Returns the shape of the expression.

Definition at line 1491 of file xreducer.hpp.

◆ operator()()

template<class F , class CT , class X , class O >
template<class... Args>
auto xt::xreducer< F, CT, X, O >::operator() ( Args... args) const -> const_reference
inline

Returns a constant reference to the element at the specified position in the reducer.

Parameters
argsa 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.

◆ options()

template<class F , class CT , class X , class O >
const O & xt::xreducer< F, CT, X, O >::options ( ) const
inline

Definition at line 901 of file xreducer.hpp.

◆ shape()

template<class F , class CT , class X , class O >
auto xt::xreducer< F, CT, X, O >::shape ( ) const
inlinenoexcept

Returns the shape of the expression.

Definition at line 1482 of file xreducer.hpp.

◆ stepper_begin()

template<class F , class CT , class X , class O >
template<class S >
auto xt::xreducer< F, CT, X, O >::stepper_begin ( const S & shape) const -> const_stepper
inlinenoexcept

Definition at line 1630 of file xreducer.hpp.

◆ stepper_end()

template<class F , class CT , class X , class O >
template<class S >
auto xt::xreducer< F, CT, X, O >::stepper_end ( const S & shape,
layout_type l ) const -> const_stepper
inlinenoexcept

Definition at line 1638 of file xreducer.hpp.

◆ unchecked()

template<class F , class CT , class X , class O >
template<class... Args>
auto xt::xreducer< F, CT, X, O >::unchecked ( Args... args) const -> const_reference
inline

Returns a constant reference to the element at the specified position in the reducer.

Parameters
argsa 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.
Warning
This method is meant for performance, for expressions with a dynamic number of dimensions (i.e. not known at compile time). Since it may have undefined behavior (see parameters), operator() should be preferred whenever it is possible.
This method is NOT compatible with broadcasting, meaning the following code has undefined behavior:
xt::xarray<double> a = {{0, 1}, {2, 3}};
xt::xarray<double> b = {0, 1};
auto fd = a + b;
double res = fd.uncheked(0, 1);

Definition at line 1545 of file xreducer.hpp.

Friends And Related Symbol Documentation

◆ xreducer_stepper< F, CT, X, O >

template<class F , class CT , class X , class O >
friend class xreducer_stepper< F, CT, X, O >
friend

Definition at line 915 of file xreducer.hpp.

Member Data Documentation

◆ contiguous_layout

template<class F , class CT , class X , class O >
constexpr bool xt::xreducer< F, CT, X, O >::contiguous_layout = false
staticconstexpr

Definition at line 855 of file xreducer.hpp.

◆ static_layout

template<class F , class CT , class X , class O >
constexpr layout_type xt::xreducer< F, CT, X, O >::static_layout = layout_type::dynamic
staticconstexpr

Definition at line 854 of file xreducer.hpp.


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