Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.hypot

Contents

jax.numpy.hypot#

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

Return element-wise hypotenuse for the given legs of a right angle triangle.

JAX implementation ofnumpy.hypot.

Parameters:
  • x1 (ArrayLike) – scalar or array. Specifies one of the legs of right angle triangle.complex dtype are not supported.

  • x2 (ArrayLike) – scalar or array. Specifies the other leg of right angle triangle.complex dtype are not supported.x1 andx2 must either havesame shape or be broadcast compatible.

Returns:

An array containing the hypotenuse for the given given legsx1 andx2of a right angle triangle, promoting to inexact dtype.

Return type:

Array

Note

jnp.hypot is a more numerically stable way of computingjnp.sqrt(x1**2+x2**2).

Examples

>>>jnp.hypot(3,4)Array(5., dtype=float32, weak_type=True)>>>x1=jnp.array([[3,-2,5],...[9,1,-4]])>>>x2=jnp.array([-5,6,8])>>>withjnp.printoptions(precision=3,suppress=True):...jnp.hypot(x1,x2)Array([[ 5.831,  6.325,  9.434],       [10.296,  6.083,  8.944]], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp