Compute the eigenvalues and right eigenvectors of a square array.
Parameters :  a : (M, M) array_like


Returns :  w : (M,) ndarray
v : (M, M) ndarray

Raises :  LinAlgError :

See also
Notes
This is a simple interface to the LAPACK routines dgeev and zgeev which compute the eigenvalues and eigenvectors of, respectively, general real and complexvalued square arrays.
The number w is an eigenvalue of a if there exists a vector v such that dot(a,v) = w * v. Thus, the arrays a, w, and v satisfy the equations dot(a[i,:], v[i]) = w[i] * v[:,i] for .
The array v of eigenvectors may not be of maximum rank, that is, some of the columns may be linearly dependent, although roundoff error may obscure that fact. If the eigenvalues are all different, then theoretically the eigenvectors are linearly independent. Likewise, the (complexvalued) matrix of eigenvectors v is unitary if the matrix a is normal, i.e., if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate transpose of a.
Finally, it is emphasized that v consists of the right (as in righthand side) eigenvectors of a. A vector y satisfying dot(y.T, a) = z * y.T for some number z is called a left eigenvector of a, and, in general, the left and right eigenvectors of a matrix are not necessarily the (perhaps conjugate) transposes of each other.
References
G. Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, Academic Press, Inc., 1980, Various pp.
Examples
>>> from numpy import linalg as LA
(Almost) trivial example with real evalues and evectors.
>>> w, v = LA.eig(np.diag((1, 2, 3)))
>>> w; v
array([ 1., 2., 3.])
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
Real matrix possessing complex evalues and evectors; note that the evalues are complex conjugates of each other.
>>> w, v = LA.eig(np.array([[1, 1], [1, 1]]))
>>> w; v
array([ 1. + 1.j, 1.  1.j])
array([[ 0.70710678+0.j , 0.70710678+0.j ],
[ 0.000000000.70710678j, 0.00000000+0.70710678j]])
Complexvalued matrix with real evalues (but complexvalued evectors); note that a.conj().T = a, i.e., a is Hermitian.
>>> a = np.array([[1, 1j], [1j, 1]])
>>> w, v = LA.eig(a)
>>> w; v
array([ 2.00000000e+00+0.j, 5.98651912e36+0.j]) # i.e., {2, 0}
array([[ 0.00000000+0.70710678j, 0.70710678+0.j ],
[ 0.70710678+0.j , 0.00000000+0.70710678j]])
Be careful about roundoff error!
>>> a = np.array([[1 + 1e9, 0], [0, 1  1e9]])
>>> # Theor. evalues are 1 +/ 1e9
>>> w, v = LA.eig(a)
>>> w; v
array([ 1., 1.])
array([[ 1., 0.],
[ 0., 1.]])