log2

Contents

log2#

class saiunit.math.log2(x, unit_to_scale=None, **kwargs)#

Base-2 logarithm, element-wise.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input array or Quantity. Must be positive.

  • unit_to_scale (saiunit.Unit | None) – Unit used to convert x to a dimensionless number first.

Returns:

out – Element-wise base-2 logarithm.

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.log2(jnp.array([1.0, 2.0, 4.0]))
Array([0., 1., 2.], dtype=float32)