MCPcopy
hub / github.com/numpy/numpy / eigvals

Function eigvals

numpy/linalg/_linalg.py:1182–1262  ·  view source on GitHub ↗

Compute the eigenvalues of a general matrix. Main difference between `eigvals` and `eig`: the eigenvectors aren't returned. Parameters ---------- a : (..., M, M) array_like A complex- or real-valued matrix whose eigenvalues will be computed. Returns ------

(a)

Source from the content-addressed store, hash-verified

1180
1181@array_function_dispatch(_unary_dispatcher)
1182def eigvals(a):
1183 """
1184 Compute the eigenvalues of a general matrix.
1185
1186 Main difference between `eigvals` and `eig`: the eigenvectors aren't
1187 returned.
1188
1189 Parameters
1190 ----------
1191 a : (..., M, M) array_like
1192 A complex- or real-valued matrix whose eigenvalues will be computed.
1193
1194 Returns
1195 -------
1196 w : (..., M,) ndarray
1197 The eigenvalues, each repeated according to its multiplicity.
1198 They are not necessarily ordered, nor are they necessarily
1199 real for real matrices.
1200
1201 Raises
1202 ------
1203 LinAlgError
1204 If the eigenvalue computation does not converge.
1205
1206 See Also
1207 --------
1208 eig : eigenvalues and right eigenvectors of general arrays
1209 eigvalsh : eigenvalues of real symmetric or complex Hermitian
1210 (conjugate symmetric) arrays.
1211 eigh : eigenvalues and eigenvectors of real symmetric or complex
1212 Hermitian (conjugate symmetric) arrays.
1213 scipy.linalg.eigvals : Similar function in SciPy.
1214
1215 Notes
1216 -----
1217 Broadcasting rules apply, see the `numpy.linalg` documentation for
1218 details.
1219
1220 This is implemented using the ``_geev`` LAPACK routines which compute
1221 the eigenvalues and eigenvectors of general square arrays.
1222
1223 Examples
1224 --------
1225 Illustration, using the fact that the eigenvalues of a diagonal matrix
1226 are its diagonal elements, that multiplying a matrix on the left
1227 by an orthogonal matrix, `Q`, and on the right by `Q.T` (the transpose
1228 of `Q`), preserves the eigenvalues of the "middle" matrix. In other words,
1229 if `Q` is orthogonal, then ``Q * A * Q.T`` has the same eigenvalues as
1230 ``A``:
1231
1232 >>> import numpy as np
1233 >>> from numpy import linalg as LA
1234 >>> x = np.random.random()
1235 >>> Q = np.array([[np.cos(x), -np.sin(x)], [np.sin(x), np.cos(x)]])
1236 >>> LA.norm(Q[0, :]), LA.norm(Q[1, :]), np.dot(Q[0, :],Q[1, :])
1237 (1.0, 1.0, 0.0)
1238
1239 Now multiply a diagonal matrix by ``Q`` on one side and

Callers 2

polyFunction · 0.90
rootsFunction · 0.90

Calls 8

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…