numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
eigvalsh(a, UPLO='L')

Main difference from eigh: the eigenvectors are not computed.

Notes

versionadded

Broadcasting rules apply, see the numpy.linalg documentation for details.

The eigenvalues are computed using LAPACK routines _syevd , _heevd .

Parameters

a : (..., M, M) array_like

A complex- or real-valued matrix whose eigenvalues are to be computed.

UPLO : {'L', 'U'}, optional

Specifies 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.

Raises

LinAlgError

If the eigenvalue computation does not converge.

Returns

w : (..., M,) ndarray

The eigenvalues in ascending order, each repeated according to its multiplicity.

Compute the eigenvalues of a complex Hermitian or real symmetric matrix.

See Also

eig

eigenvalues and right eigenvectors of general real or complex arrays.

eigh

eigenvalues and eigenvectors of real symmetric or complex Hermitian (conjugate symmetric) arrays.

eigvals

eigenvalues of general real or complex arrays.

scipy.linalg.eigvalsh

Similar function in SciPy.

Examples

>>> from numpy import linalg as LA
... a = np.array([[1, -2j], [2j, 5]])
... LA.eigvalsh(a) array([ 0.17157288, 5.82842712]) # may vary
>>> # demonstrate the treatment of the imaginary part of the diagonal
... a = np.array([[5+2j, 9-2j], [0+2j, 2-1j]])
... a array([[5.+2.j, 9.-2.j], [0.+2.j, 2.-1.j]])
>>> # with UPLO='L' this is numerically equivalent to using LA.eigvals()
... # with:
... b = np.array([[5.+0.j, 0.-2.j], [0.+2.j, 2.-0.j]])
... b array([[5.+0.j, 0.-2.j], [0.+2.j, 2.+0.j]])
>>> wa = LA.eigvalsh(a)
... wb = LA.eigvals(b)
... wa; wb array([1., 6.]) array([6.+0.j, 1.+0.j])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.linalg.eig numpy.linalg.eigh numpy.polynomial.hermite.hermcompanion numpy.polynomial.hermite_e.hermecompanion numpy.linalg.eigvals numpy.polynomial.chebyshev.chebcompanion numpy.polynomial.legendre.legcompanion

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/linalg/linalg.py#1072
type: <class 'function'>
Commit: