Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.gcd

Contents

jax.numpy.gcd#

jax.numpy.gcd(x1,x2)[source]#

Compute the greatest common divisor of two arrays.

JAX implementation ofnumpy.gcd().

Parameters:
  • x1 (ArrayLike) – First input array. The elements must have integer dtype.

  • x2 (ArrayLike) – Second input array. The elements must have integer dtype.

Returns:

An array containing the greatest common divisors of the correspondingelements from the absolute values ofx1 andx2.

Return type:

Array

See also

Examples

Scalar inputs:

>>>jnp.gcd(12,18)Array(6, dtype=int32, weak_type=True)

Array inputs:

>>>x1=jnp.array([12,18,24])>>>x2=jnp.array([5,10,15])>>>jnp.gcd(x1,x2)Array([1, 2, 3], dtype=int32)

Broadcasting:

>>>x1=jnp.array([12])>>>x2=jnp.array([6,9,12])>>>jnp.gcd(x1,x2)Array([ 6,  3, 12], dtype=int32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp