Reducing functions

xtensor provides the following reducing functions for xexpressions:

Defined in xtensor/xmath.hpp

template <class E, class X>
auto xt::sum(E &&e, X &&axes)

Sum of elements over given axes.

Returns an xreducer for the sum of elements over given axes.

Return
an xreducer
Parameters
  • e: an xexpression
  • axes: the axes along which the sum is performed (optional)

template <class E, class X>
auto xt::prod(E &&e, X &&axes)

Product of elements over given axes.

Returns an xreducer for the product of elements over given axes.

Return
an xreducer
Parameters
  • e: an xexpression
  • axes: the axes along which the product is computed (optional)

template <class E, class X>
auto xt::mean(E &&e, X &&axes)

Mean of elements over given axes.

Returns an xreducer for the mean of elements over given axes.

Return
an xexpression
Parameters
  • e: an xexpression
  • axes: the axes along which the mean is computed (optional)