Accumulating functionsΒΆ
xtensor provides the following accumulating functions for xexpressions:
Defined in xtensor/xmath.hpp
-
template<class
T
= void, classE
>
autoxt
::
cumsum
(E &&e)
-
template<class
T
= void, classE
>
autoxt
::
cumsum
(E &&e, std::ptrdiff_t axis) Cumulative sum.
Returns the accumulated sum for the elements over given axis (or flattened).
- Return
an xarray<T>
- Parameters
e
: an xexpressionaxis
: the axes along which the cumulative sum is computed (optional)
- Template Parameters
T
: the value type used for internal computation. The default isE::value_type
.T
is also used for determining the value type of the result, which is the type ofT() + E::value_type()
. You can passbig_promote_value_type_t<E>
to avoid overflow in computation.
-
template<class
T
= void, classE
>
autoxt
::
cumprod
(E &&e)
-
template<class
T
= void, classE
>
autoxt
::
cumprod
(E &&e, std::ptrdiff_t axis) Cumulative product.
Returns the accumulated product for the elements over given axis (or flattened).
- Return
an xarray<T>
- Parameters
e
: an xexpressionaxis
: the axes along which the cumulative product is computed (optional)
- Template Parameters
T
: the value type used for internal computation. The default isE::value_type
.T
is also used for determining the value type of the result, which is the type ofT() * E::value_type()
. You can passbig_promote_value_type_t<E>
to avoid overflow in computation.