scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
eig(a, b=None, left=False, right=True, overwrite_a=False, overwrite_b=False, check_finite=True, homogeneous_eigvals=False)

Find eigenvalues w and right or left eigenvectors of a general matrix:

a   vr[:,i] = w[i]        b   vr[:,i]
a.H vl[:,i] = w[i].conj() b.H vl[:,i]

where .H is the Hermitian conjugation.

Parameters

a : (M, M) array_like

A complex or real matrix whose eigenvalues and eigenvectors will be computed.

b : (M, M) array_like, optional

Right-hand side matrix in a generalized eigenvalue problem. Default is None, identity matrix is assumed.

left : bool, optional

Whether to calculate and return left eigenvectors. Default is False.

right : bool, optional

Whether to calculate and return right eigenvectors. Default is True.

overwrite_a : bool, optional

Whether to overwrite a; may improve performance. Default is False.

overwrite_b : bool, optional

Whether to overwrite b; may improve performance. Default is False.

check_finite : bool, optional

Whether to check that the input matrices contain only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

homogeneous_eigvals : bool, optional

If True, return the eigenvalues in homogeneous coordinates. In this case w is a (2, M) array so that:

w[1,i] a vr[:,i] = w[0,i] b vr[:,i]

Default is False.

Raises

LinAlgError

If eigenvalue computation does not converge.

Returns

w : (M,) or (2, M) double or complex ndarray

The eigenvalues, each repeated according to its multiplicity. The shape is (M,) unless homogeneous_eigvals=True .

vl : (M, M) double or complex ndarray

The normalized left eigenvector corresponding to the eigenvalue w[i] is the column vl[:,i]. Only returned if left=True .

vr : (M, M) double or complex ndarray

The normalized right eigenvector corresponding to the eigenvalue w[i] is the column vr[:,i] . Only returned if right=True .

Solve an ordinary or generalized eigenvalue problem of a square matrix.

See Also

eig_banded

eigenvalues and right eigenvectors for symmetric/Hermitian band matrices

eigh

Eigenvalues and right eigenvectors for symmetric/Hermitian arrays.

eigh_tridiagonal

eigenvalues and right eiegenvectors for symmetric/Hermitian tridiagonal matrices

eigvals

eigenvalues of general arrays

Examples

>>> from scipy import linalg
... a = np.array([[0., -1.], [1., 0.]])
... linalg.eigvals(a) array([0.+1.j, 0.-1.j])
>>> b = np.array([[0., 1.], [1., 1.]])
... linalg.eigvals(a, b) array([ 1.+0.j, -1.+0.j])
>>> a = np.array([[3., 0., 0.], [0., 8., 0.], [0., 0., 7.]])
... linalg.eigvals(a, homogeneous_eigvals=True) array([[3.+0.j, 8.+0.j, 7.+0.j], [1.+0.j, 1.+0.j, 1.+0.j]])
>>> a = np.array([[0., -1.], [1., 0.]])
... linalg.eigvals(a) == linalg.eig(a)[0] array([ True, True])
>>> linalg.eig(a, left=True, right=False)[1] # normalized left eigenvector
array([[-0.70710678+0.j        , -0.70710678-0.j        ],
       [-0.        +0.70710678j, -0.        -0.70710678j]])
>>> linalg.eig(a, left=False, right=True)[1] # normalized right eigenvector
array([[0.70710678+0.j        , 0.70710678-0.j        ],
       [0.        -0.70710678j, 0.        +0.70710678j]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.linalg._decomp.eigvals_banded scipy.linalg._decomp.eigvals scipy.linalg._decomp.eigh scipy.linalg._decomp.eigh_tridiagonal scipy.linalg._decomp.eig scipy.linalg._decomp.eig_banded

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_decomp.py#115
type: <class 'function'>
Commit: