all

Contents

all#

class brainunit.math.all(x, axis=None, keepdims=False, where=None, **kwargs)#

Test whether all array elements along a given axis evaluate to True.

The input must be dimensionless; a TypeError is raised if x carries physical units.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array. Must be dimensionless if it is a Quantity.

  • axis (int | None) – Axis or axes along which a logical AND reduction is performed. The default (axis=None) reduces over all dimensions.

  • keepdims (bool) – If True, reduced axes are kept as dimensions with size one.

  • where (Array | None) – Elements to include in the check.

Returns:

all – Boolean result of the AND reduction.

Return type:

bool | Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.all(jnp.array([True, True, True]))
Array(True, dtype=bool)
>>> u.math.all(jnp.array([True, False, True]))
Array(False, dtype=bool)
>>> u.math.all(jnp.array([[True, False], [True, True]]), axis=1)
Array([False,  True], dtype=bool)