eigh(a, upper=False)

Return the eigenvalues and eigenvectors real symmetric matrix.

Returns two objects, a 1-D array containing the eigenvalues of a, and a 2-D square array or matrix (depending on the input type) of the corresponding eigenvectors (in columns).

  • a ((.., M, M) ndarray) – real symmetric matrices whose eigenvalues and eigenvectors 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 ((…, M) ndarray) – The eigenvalues in ascending order, each repeated according to its multiplicity.

  • v ({(…, M, M) ndarray, (…, M, M) matrix}) – The column v[:, i] is the normalized eigenvector corresponding to the eigenvalue w[i]. Will return a matrix object if a is a matrix object.


MXNetError – If the eigenvalue computation does not converge.

See also


eigenvalues and right eigenvectors of general arrays


eigenvalues of a non-symmetric array.


eigenvalues of a real symmetric.


The eigenvalues/eigenvectors are computed using LAPACK routines _syevd. This function differs from the original numpy.linalg.eigh in the following way(s): * Does not support complex input and output.


>>> from numpy import linalg as LA
>>> a = np.array([[ 6.8189726 , -3.926585  ,  4.3990498 ],
...               [-0.59656644, -1.9166266 ,  9.54532   ],
...               [ 2.1093285 ,  0.19688708, -1.1634291 ]])
>>> w, v = LA.eigh(a, upper=False)
>>> w
array([-2.175445 , -1.4581827,  7.3725457])
>>> v
array([[ 0.1805163 , -0.16569263,  0.9695154 ],
       [ 0.8242942 ,  0.56326365, -0.05721384],
       [-0.53661287,  0.80949366,  0.23825769]])