eig¶
- eig(x: array, /) Tuple[array, array]¶
Returns eigenvalues and eigenvectors of a real or complex matrix (or stack of matrices)
x.Let \(\mathbb{K}\) be the union of the set of real numbers \(\mathbb{R}\) and the set of complex numbers, \(\mathbb{C}\).
A real or complex value \(lambda \in \mathbb{K}\) is an eigenvalue of a real or complex matrix \(x \in \mathbb{K}^{n \times n}\) if there exists a real or complex vector \(v \in \mathbb{K}^{n}\), such that
\[x v = \lambda v\]Then, \(v\) is referred to as an eigenvector of \(x\), corresponding to the eigenvalue \(\lambda\).
A general matrix \(x \in \mathbb{K}^{n \times n}\)
has \(n\) eigenvalues, which are defined as the roots (counted with multiplicity) of the polynomial \(p\) of degree \(n\) given by
\[p(\lambda) = \operatorname{det}(x - \lambda I_n)\]does not in general have \(n\) linearly independent eigenvectors if it has eigenvalues with multiplicity larger than one.
Note
The eigenvalues of a non-symmetric real matrix are in general complex: for :math:x in mathbb{R}^{n times n}`, the eigenvalues, \(\lambda \in \mathbb{C}\), may or may not reside on the real axis of the complex plane.
Warning
The eigenvectors of a general matrix are not unique and are not continuous with respect to
x. Because eigenvectors are not unique, different hardware and software may compute different eigenvectors.For eigenvalues of multiplity \(s=1\), the non-uniqueness stems from the fact that multiplying an eigenvector by \(-1\) when
xis real-valued and by \(e^{\phi j}\) (\(\phi \in \mathbb{R}\)) whenxis complex produces another set of valid eigenvectors.For eigenvalues of multiplity \(s > 1\), the \(s\) computed eigenvectors may be repeated or have entries differ by an order of machine epsilon for the data type of \(x\).
- Parameters:
x (array) – input array having shape
(..., M, M)and whose innermost two dimensions form square matrices. Should have a floating-point data type.- Returns:
out (Tuple[array, array]) – a namedtuple (
eigenvalues,eigenvectors) whosefirst element must have the field name
eigenvalues(corresponding to \(\lambda\) above) and must be an array consisting of computed eigenvalues. The array containing the eigenvalues must have shape(..., M)and must have a complex floating-point array data type having the same precision as that ofx(e.g., ifxhas afloat32data type,eigenvaluesmust have thecomplex64data type; ifxhas afloat64data type,eigenvalueshave thecomplex128data type).second element must have the field name
eigenvectors(corresponding to \(v\) above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape(..., M, M)and must have the same data type aseigenvalues.
Notes
Eigenvalue sort order is left unspecified and is thus implementation-dependent.
Note
For real symmetric or complex Hermitian matrices, prefer using the
eighroutine.New in version 2025.12.