eigvalsh(a, upper=False)

Compute the eigenvalues real symmetric matrix.

Main difference from eigh: the eigenvectors are not computed.

  • a ((.., M, M) ndarray) – A 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.


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

Return type

(.., M,) ndarray


MXNetError – If the eigenvalue computation does not converge.

See also


eigenvalues and right eigenvectors of general arrays


eigenvalues of a non-symmetric array.


eigenvalues and eigenvectors of a real symmetric array.


Broadcasting rules apply, see the numpy.linalg documentation for details. The eigenvalues are computed using LAPACK routines _syevd. This function differs from the original numpy.linalg.eigvalsh in the following way(s): * Does not support complex input and output.


>>> from numpy import linalg as LA
>>> a = np.array([[ 5.4119368 ,  8.996273  , -5.086096  ],
...               [ 0.8866155 ,  1.7490431 , -4.6107802 ],
...               [-0.08034172,  4.4172044 ,  1.4528792 ]])
>>> LA.eigvalsh(a, UPLO='L')
array([-2.87381886,  5.10144682,  6.38623114]) # in ascending order