eigvalsh

eigvalsh(x: array, /) array

Returns the eigenvalues of a complex Hermitian or real symmetric matrix (or a stack of matrices) x.

If x is real-valued, let K be the set of real numbers R, and, if x is complex-valued, let K be the set of complex numbers C.

The eigenvalues of a complex Hermitian or real symmetric matrix x Kn×n are defined as the roots (counted with multiplicity) of the polynomial p of degree n given by

p(λ)=det(xλIn)

where λR and where In is the n-dimensional identity matrix.

Note

Whether an array library explicitly checks whether an input array is Hermitian or a symmetric matrix (or a stack of matrices) is implementation-defined.

Note

The function eigvals will be added in a future version of the specification.

Parameters:

x (array) – input array having shape (..., M, M) and whose innermost two dimensions form square matrices. Should have a floating-point data type.

Returns:

out (array) – an array containing the computed eigenvalues. The returned array must have shape (..., M) and have a real-valued floating-point data type whose precision matches the precision of x (e.g., if x is complex128, then must have a float64 data type).

Notes

Note

Eigenvalue sort order is left unspecified and is thus implementation-dependent.

Changed in version 2022.12: Added complex data type support.