MCPcopy Index your code
hub / github.com/numpy/numpy / eig

Function eig

numpy/linalg/_linalg.py:1367–1510  ·  view source on GitHub ↗

Compute the eigenvalues and right eigenvectors of a square array. Parameters ---------- a : (..., M, M) array Matrices for which the eigenvalues and right eigenvectors will be computed Returns ------- A namedtuple with the following attributes: eig

(a)

Source from the content-addressed store, hash-verified

1365
1366@array_function_dispatch(_unary_dispatcher)
1367def eig(a):
1368 """
1369 Compute the eigenvalues and right eigenvectors of a square array.
1370
1371 Parameters
1372 ----------
1373 a : (..., M, M) array
1374 Matrices for which the eigenvalues and right eigenvectors will
1375 be computed
1376
1377 Returns
1378 -------
1379 A namedtuple with the following attributes:
1380
1381 eigenvalues : (..., M) array
1382 The eigenvalues, each repeated according to its multiplicity.
1383 The eigenvalues are not necessarily ordered. The resulting
1384 array will be of complex type, unless the imaginary part is
1385 zero in which case it will be cast to a real type. When `a`
1386 is real the resulting eigenvalues will be real (0 imaginary
1387 part) or occur in conjugate pairs
1388
1389 eigenvectors : (..., M, M) array
1390 The normalized (unit "length") eigenvectors, such that the
1391 column ``eigenvectors[:,i]`` is the eigenvector corresponding to the
1392 eigenvalue ``eigenvalues[i]``.
1393
1394 Raises
1395 ------
1396 LinAlgError
1397 If the eigenvalue computation does not converge.
1398
1399 See Also
1400 --------
1401 eigvals : eigenvalues of a non-symmetric array.
1402 eigh : eigenvalues and eigenvectors of a real symmetric or complex
1403 Hermitian (conjugate symmetric) array.
1404 eigvalsh : eigenvalues of a real symmetric or complex Hermitian
1405 (conjugate symmetric) array.
1406 scipy.linalg.eig : Similar function in SciPy that also solves the
1407 generalized eigenvalue problem.
1408 scipy.linalg.schur : Best choice for unitary and other non-Hermitian
1409 normal matrices.
1410
1411 Notes
1412 -----
1413 Broadcasting rules apply, see the `numpy.linalg` documentation for
1414 details.
1415
1416 This is implemented using the ``_geev`` LAPACK routines which compute
1417 the eigenvalues and eigenvectors of general square arrays.
1418
1419 The number `w` is an eigenvalue of `a` if there exists a vector `v` such
1420 that ``a @ v = w * v``. Thus, the arrays `a`, `eigenvalues`, and
1421 `eigenvectors` satisfy the equations ``a @ eigenvectors[:,i] =
1422 eigenvalues[i] * eigenvectors[:,i]`` for :math:`i \\in \\{0,...,M-1\\}`.
1423
1424 The array `eigenvectors` may not be of maximum rank, that is, some of the

Callers

nothing calls this directly

Calls 10

errstateClass · 0.90
_makearrayFunction · 0.85
_assert_stacked_squareFunction · 0.85
_assert_finiteFunction · 0.85
_commonTypeFunction · 0.85
isComplexTypeFunction · 0.85
_complexTypeFunction · 0.85
EigResultClass · 0.85
wrapFunction · 0.85
astypeMethod · 0.80

Tested by

no test coverage detected