Compute the eigenvalues of a Hermitian or real symmetric matrix.
Main difference from eigh: the eigenvectors are not computed.
Parameters : | a : array_like, shape (M, M)
UPLO : {‘L’, ‘U’}, optional
|
---|---|
Returns : | w : ndarray, shape (M,)
|
Raises : | LinAlgError :
|
See also
Notes
This is a simple interface to the LAPACK routines dsyevd and zheevd that sets those routines’ flags to return only the eigenvalues of real symmetric and complex Hermitian arrays, respectively.
Examples
>>> from numpy import linalg as LA
>>> a = np.array([[1, -2j], [2j, 5]])
>>> LA.eigvalsh(a)
array([ 0.17157288+0.j, 5.82842712+0.j])