array_equal

Contents

array_equal#

class brainunit.math.array_equal(x, y, *args, **kwargs)#

Return True if two arrays have the same shape and elements.

When both inputs are Quantities, y is converted to the unit of x before comparison.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – First input array.

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Second input array.

Returns:

out – True if the arrays are equal.

Return type:

bool | Array

Examples

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