cummax

Contents

cummax#

class saiunit.lax.cummax(operand, axis=0, reverse=False, **kwargs)#

Compute a cumulative maximum along axis.

Parameters:
  • operand (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

  • axis (int) – The axis along which to compute the cumulative maximum. Default is 0.

  • reverse (bool) – If True, compute the cumulative maximum in reverse. Default is False.

Returns:

result – The cumulative maximum array. Preserves the unit of operand.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> import jax.numpy as jnp
>>> q = jnp.array([3.0, 1.0, 4.0, 1.0]) * u.second
>>> result = sulax.cummax(q)
>>> result.mantissa
Array([3., 3., 4., 4.], dtype=float32)