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

Function eig

numpy/linalg/linalg.py:1194–1345  ·  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

1192
1193@array_function_dispatch(_unary_dispatcher)
1194def eig(a):
1195 """
1196 Compute the eigenvalues and right eigenvectors of a square array.
1197
1198 Parameters
1199 ----------
1200 a : (..., M, M) array
1201 Matrices for which the eigenvalues and right eigenvectors will
1202 be computed
1203
1204 Returns
1205 -------
1206 A namedtuple with the following attributes:
1207
1208 eigenvalues : (..., M) array
1209 The eigenvalues, each repeated according to its multiplicity.
1210 The eigenvalues are not necessarily ordered. The resulting
1211 array will be of complex type, unless the imaginary part is
1212 zero in which case it will be cast to a real type. When `a`
1213 is real the resulting eigenvalues will be real (0 imaginary
1214 part) or occur in conjugate pairs
1215
1216 eigenvectors : (..., M, M) array
1217 The normalized (unit "length") eigenvectors, such that the
1218 column ``eigenvectors[:,i]`` is the eigenvector corresponding to the
1219 eigenvalue ``eigenvalues[i]``.
1220
1221 Raises
1222 ------
1223 LinAlgError
1224 If the eigenvalue computation does not converge.
1225
1226 See Also
1227 --------
1228 eigvals : eigenvalues of a non-symmetric array.
1229 eigh : eigenvalues and eigenvectors of a real symmetric or complex
1230 Hermitian (conjugate symmetric) array.
1231 eigvalsh : eigenvalues of a real symmetric or complex Hermitian
1232 (conjugate symmetric) array.
1233 scipy.linalg.eig : Similar function in SciPy that also solves the
1234 generalized eigenvalue problem.
1235 scipy.linalg.schur : Best choice for unitary and other non-Hermitian
1236 normal matrices.
1237
1238 Notes
1239 -----
1240
1241 .. versionadded:: 1.8.0
1242
1243 Broadcasting rules apply, see the `numpy.linalg` documentation for
1244 details.
1245
1246 This is implemented using the ``_geev`` LAPACK routines which compute
1247 the eigenvalues and eigenvectors of general square arrays.
1248
1249 The number `w` is an eigenvalue of `a` if there exists a vector `v` such
1250 that ``a @ v = w * v``. Thus, the arrays `a`, `eigenvalues`, and
1251 `eigenvectors` satisfy the equations ``a @ eigenvectors[:,i] =

Callers

nothing calls this directly

Calls 13

allFunction · 0.90
_makearrayFunction · 0.85
_assert_stacked_2dFunction · 0.85
_assert_stacked_squareFunction · 0.85
_assert_finiteFunction · 0.85
_commonTypeFunction · 0.85
get_linalg_error_extobjFunction · 0.85
isComplexTypeFunction · 0.85
_realTypeFunction · 0.85
_complexTypeFunction · 0.85
EigResultClass · 0.85
wrapFunction · 0.85

Tested by

no test coverage detected