eigvalsh — Python array API standard 2024.12 documentation (original) (raw)
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 \(\mathbb{K}\) be the set of real numbers \(\mathbb{R}\), and, if x
is complex-valued, let \(\mathbb{K}\) be the set of complex numbers \(\mathbb{C}\).
The eigenvalues of a complex Hermitian or real symmetric matrix \(x \in\ \mathbb{K}^{n \times n}\) are defined as the roots (counted with multiplicity) of the polynomial \(p\) of degree \(n\) given by
\[p(\lambda) = \operatorname{det}(x - \lambda I_n)\]
where \(\lambda \in \mathbb{R}\) and where \(I_n\) 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.