Return element-wise hypotenuse for the given legs of a right angle triangle.
JAX implementation of numpy.hypot
.
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
and x2
must either have same shape or be broadcast compatible.
An array containing the hypotenuse for the given given legs x1
and x2
of a right angle triangle, promoting to inexact dtype.
Note
jnp.hypot
is a more numerically stable way of computing jnp.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]) >>> with jnp.printoptions(precision=3, suppress=True): ... jnp.hypot(x1, x2) Array([[ 5.831, 6.325, 9.434], [10.296, 6.083, 8.944]], dtype=float32)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3