MCPcopy Create free account
hub / github.com/numpy/numpy / eigh

Function eigh

numpy/linalg/linalg.py:1349–1490  ·  view source on GitHub ↗

Return the eigenvalues and eigenvectors of a complex Hermitian (conjugate symmetric) or a 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

(a, UPLO='L')

Source from the content-addressed store, hash-verified

1347
1348@array_function_dispatch(_eigvalsh_dispatcher)
1349def eigh(a, UPLO='L'):
1350 """
1351 Return the eigenvalues and eigenvectors of a complex Hermitian
1352 (conjugate symmetric) or a real symmetric matrix.
1353
1354 Returns two objects, a 1-D array containing the eigenvalues of `a`, and
1355 a 2-D square array or matrix (depending on the input type) of the
1356 corresponding eigenvectors (in columns).
1357
1358 Parameters
1359 ----------
1360 a : (..., M, M) array
1361 Hermitian or real symmetric matrices whose eigenvalues and
1362 eigenvectors are to be computed.
1363 UPLO : {'L', 'U'}, optional
1364 Specifies whether the calculation is done with the lower triangular
1365 part of `a` ('L', default) or the upper triangular part ('U').
1366 Irrespective of this value only the real parts of the diagonal will
1367 be considered in the computation to preserve the notion of a Hermitian
1368 matrix. It therefore follows that the imaginary part of the diagonal
1369 will always be treated as zero.
1370
1371 Returns
1372 -------
1373 A namedtuple with the following attributes:
1374
1375 eigenvalues : (..., M) ndarray
1376 The eigenvalues in ascending order, each repeated according to
1377 its multiplicity.
1378 eigenvectors : {(..., M, M) ndarray, (..., M, M) matrix}
1379 The column ``eigenvectors[:, i]`` is the normalized eigenvector
1380 corresponding to the eigenvalue ``eigenvalues[i]``. Will return a
1381 matrix object if `a` is a matrix object.
1382
1383 Raises
1384 ------
1385 LinAlgError
1386 If the eigenvalue computation does not converge.
1387
1388 See Also
1389 --------
1390 eigvalsh : eigenvalues of real symmetric or complex Hermitian
1391 (conjugate symmetric) arrays.
1392 eig : eigenvalues and right eigenvectors for non-symmetric arrays.
1393 eigvals : eigenvalues of non-symmetric arrays.
1394 scipy.linalg.eigh : Similar function in SciPy (but also solves the
1395 generalized eigenvalue problem).
1396
1397 Notes
1398 -----
1399
1400 .. versionadded:: 1.8.0
1401
1402 Broadcasting rules apply, see the `numpy.linalg` documentation for
1403 details.
1404
1405 The eigenvalues/eigenvectors are computed using LAPACK routines ``_syevd``,
1406 ``_heevd``.

Callers 1

svdFunction · 0.70

Calls 11

_makearrayFunction · 0.85
_assert_stacked_2dFunction · 0.85
_assert_stacked_squareFunction · 0.85
_commonTypeFunction · 0.85
get_linalg_error_extobjFunction · 0.85
isComplexTypeFunction · 0.85
_realTypeFunction · 0.85
wrapFunction · 0.85
upperMethod · 0.80
astypeMethod · 0.80
EighResultClass · 0.70

Tested by

no test coverage detected