Cumulative Operations
Cumulative operations return an array of the same size as the input, where each element is the running total (sum or product) of all preceding elements along the specified axis.cumsum
Return the cumulative sum of elements along a given axis.Also exported as
cumulative_sum for compatibility with the newer NumPy naming convention.| Parameter | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axis | number | undefined | Axis along which to compute the cumulative sum. When undefined, the input is flattened before computing. |
dtype | DType | undefined | Desired output dtype. If undefined, the dtype is inferred from the input. |
NDArray containing the cumulative sums.
cumprod
Return the cumulative product of elements along a given axis.Also exported as
cumulative_prod for compatibility with the newer NumPy naming convention.| Parameter | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axis | number | undefined | Axis along which to compute the cumulative product. When undefined, the input is flattened before computing. |
dtype | DType | undefined | Desired output dtype. If undefined, the dtype is inferred from the input. |
NDArray containing the cumulative products.