clz

Contents

clz#

class brainunit.lax.clz(x)#

Elementwise count of leading zeros.

Parameters:

x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input integer array. If a Quantity, the unit is stripped before computing.

Returns:

result – The count of leading zeros in each element. Always unitless.

Return type:

Array

Examples

>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> import jax.numpy as jnp
>>> x = jnp.array([1, 2, 4], dtype=jnp.int32)
>>> sulax.clz(x)
Array([31, 30, 29], dtype=int32)