bundles / numpy latest / numpy / linalg / eigvals
_ArrayFunctionDispatcher
numpy.linalg:eigvals
source: build-install/usr/lib/python3.14/site-packages/numpy/linalg/_linalg.py :1170
Signature
def eigvals ( a ) Summary
Compute the eigenvalues of a general matrix.
Extended Summary
Main difference between eigvals and eig: the eigenvectors aren't returned.
Parameters
a: (..., M, M) array_likeA complex- or real-valued matrix whose eigenvalues will be computed.
Returns
w: (..., M,) ndarrayThe eigenvalues, each repeated according to its multiplicity. They are not necessarily ordered, nor are they necessarily real for real matrices.
Raises
: LinAlgErrorIf the eigenvalue computation does not converge.
Notes
Broadcasting rules apply, see the numpy.linalg documentation for details.
This is implemented using the _geev LAPACK routines which compute the eigenvalues and eigenvectors of general square arrays.
Examples
Illustration, using the fact that the eigenvalues of a diagonal matrix are its diagonal elements, that multiplying a matrix on the left by an orthogonal matrix, `Q`, and on the right by `Q.T` (the transpose of `Q`), preserves the eigenvalues of the "middle" matrix. In other words, if `Q` is orthogonal, then ``Q * A * Q.T`` has the same eigenvalues as ``A``:import numpy as np from numpy import linalg as LA x = np.random.random() Q = np.array([[np.cos(x), -np.sin(x)], [np.sin(x), np.cos(x)]])✓
LA.norm(Q[0, :]), LA.norm(Q[1, :]), np.dot(Q[0, :],Q[1, :])
✗D = np.diag((-1,1)) LA.eigvals(D) A = np.dot(Q, D) A = np.dot(A, Q.T)✓
LA.eigvals(A)
✗See also
Aliases
-
numpy.linalg.eigvals