logaddexp2#
- class brainunit.math.logaddexp2(x, y, unit_to_scale=None, **kwargs)#
Logarithm of the sum of exponentiations of the inputs in base 2.
Computes
log2(2**x + 2**y)in a numerically stable way.- Parameters:
x (
Array|ndarray|bool|number|bool|int|float|complex| saiunit.Quantity) – First input.y (
Array|ndarray|bool|number|bool|int|float|complex| saiunit.Quantity) – Second input. Must be broadcastable withx.unit_to_scale (saiunit.Unit |
None) – Unit used to convert both inputs to dimensionless numbers.
- Returns:
out – Element-wise
log2(2**x + 2**y).- Return type:
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> u.math.logaddexp2(jnp.array([1.0]), jnp.array([2.0])) Array([2.321928], dtype=float32)