heaviside#
- class brainunit.math.heaviside(x1, x2, **kwargs)#
Compute the Heaviside step function.
The unit is stripped from
x1before evaluation.x2must be dimensionless (it is the value returned wherex1 == 0).- Parameters:
x1 (saiunit.Quantity |
Array) – Input values.x2 (saiunit.Quantity |
Array|ndarray|number|bool) – The value of the function whenx1is zero. Must be dimensionless if given as a Quantity.
- Returns:
out – The Heaviside step function applied to
x1with half-valuex2.- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> u.math.heaviside(jnp.array([-1.0, 0.0, 1.0]), ... jnp.array([0.5, 0.5, 0.5])) Array([0. , 0.5, 1. ], dtype=float32)