nancumsum#
- class saiunit.math.nancumsum(x, axis=None, dtype=None, **kwargs)#
Return the cumulative sum of the array elements, ignoring NaNs.
- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – Input array.axis (
int|Sequence[int] |None) – Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.dtype (
str|type[Any] |dtype|SupportsDType|None) – Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.
- Returns:
out – Quantity if x is a Quantity, else an array.
- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> a = [1.0, jnp.nan, 3.0] * u.meter >>> u.math.nancumsum(a)