Accumulating functions

xtensor provides the following accumulating functions for xexpressions:

Defined in xtensor/xmath.hpp

template <class E>
auto xt::cumsum(E &&e)
template <class E>
auto xt::cumsum(E &&e, std::size_t axis)

Cumulative sum.

Returns the accumulated sum for the elements over given axis (or flattened).

Return
an xarray<T>
Parameters
  • e: an xexpression
  • axis: the axes along which the cumulative sum is computed (optional)

template <class E>
auto xt::cumprod(E &&e)
template <class E>
auto xt::cumprod(E &&e, std::size_t axis)

Cumulative product.

Returns the accumulated product for the elements over given axis (or flattened).

Return
an xarray<T>
Parameters
  • e: an xexpression
  • axis: the axes along which the cumulative product is computed (optional)