jax.numpy.linalg.eigvalsh

Contents

jax.numpy.linalg.eigvalsh#

jax.numpy.linalg.eigvalsh(a, UPLO='L')[source]#

Computes the eigenvalues of a Hermitian matrix.

JAX implementation of numpy.linalg.eigvalsh().

Parameters:
  • a (jax.typing.ArrayLike) – array of shape (..., M, M), containing the Hermitian (if complex) or symmetric (if real) matrix.

  • UPLO (str | None) – specifies whether the calculation is done with the lower triangular part of a ('L', default) or the upper triangular part ('U').

Returns:

An array of shape (..., M) containing the eigenvalues, sorted in ascending order.

Return type:

Array

See also

Examples

>>> a = jnp.array([[1, -2j],
...                [2j, 1]])
>>> w = jnp.linalg.eigvalsh(a)
>>> w
Array([-1.,  3.], dtype=float32)