bundles / numpy latest / numpy / linalg / eigvalsh
_ArrayFunctionDispatcher
numpy.linalg:eigvalsh
source: build-install/usr/lib/python3.14/site-packages/numpy/linalg/_linalg.py :1265
Signature
def eigvalsh ( a , UPLO = L ) Summary
Compute the eigenvalues of a complex Hermitian or real symmetric matrix.
Extended Summary
Main difference from eigh: the eigenvectors are not computed.
Parameters
a: (..., M, M) array_likeA complex- or real-valued matrix whose eigenvalues are to be computed.
UPLO: {'L', 'U'}, optionalSpecifies whether the calculation is done with the lower triangular part of
a('L', default) or the upper triangular part ('U'). Irrespective of this value only the real parts of the diagonal will be considered in the computation to preserve the notion of a Hermitian matrix. It therefore follows that the imaginary part of the diagonal will always be treated as zero.
Returns
w: (..., M,) ndarrayThe eigenvalues in ascending order, each repeated according to its multiplicity.
Raises
: LinAlgErrorIf the eigenvalue computation does not converge.
Notes
Broadcasting rules apply, see the numpy.linalg documentation for details.
The eigenvalues are computed using LAPACK routines _syevd, _heevd.
Examples
import numpy as np from numpy import linalg as LA a = np.array([[1, -2j], [2j, 5]])✓
LA.eigvalsh(a)
✗a = np.array([[5+2j, 9-2j], [0+2j, 2-1j]]) a b = np.array([[5.+0.j, 0.-2.j], [0.+2.j, 2.-0.j]])✓
b
✗wa = LA.eigvalsh(a) wb = LA.eigvals(b) wa wb✓
See also
Aliases
-
numpy.linalg.eigvalsh