jax.numpy.angle#
- jax.numpy.angle(z, deg=False)[source]#
Return the angle of a complex valued number or array.
JAX implementation of
numpy.angle()
.- Parameters:
z (ArrayLike) – A complex number or an array of complex numbers.
deg (bool) – Boolean. If
True
, returns the result in degrees else returns in radians. Default isFalse
.
- Returns:
An array of counterclockwise angle of each element of
z
, with the same shape asz
of dtype float.- Return type:
Examples
If
z
is a number>>> z1 = 2+3j >>> jnp.angle(z1) Array(0.98279375, dtype=float32, weak_type=True)
If
z
is an array>>> z2 = jnp.array([[1+3j, 2-5j], ... [4-3j, 3+2j]]) >>> with jnp.printoptions(precision=2, suppress=True): ... print(jnp.angle(z2)) [[ 1.25 -1.19] [-0.64 0.59]]
If
deg=True
.>>> with jnp.printoptions(precision=2, suppress=True): ... print(jnp.angle(z2, deg=True)) [[ 71.57 -68.2 ] [-36.87 33.69]]