gcd

Contents

gcd#

class brainunit.math.gcd(x1, x2, **kwargs)#

Return the greatest common divisor of x1 and x2.

Parameters:
  • x1 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

  • x2 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

Returns:

out – Quantity if x1 and x2 are Quantities that have the same unit, else an array.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.array([4, 6]) * u.second
>>> b = jnp.array([6, 8]) * u.second
>>> u.math.gcd(a.astype(jnp.int64), b.astype(jnp.int64))