spec - eigenvalues of matrices and pencils
[evals,X] =spec(A) returns in addition the eigenvectors A (if they exist). See also bdiag
[al,be] = spec(A,E) returns the spectrum of the matrix pencil s E - A, i.e. the roots of the polynomial matrix s E - A. The eigenvalues are given by al./be and if be(i) = 0 the ith eigenvalue is at infinity. (For E = eye(A), al./be is spec(A)).
[al,be,Z] = spec(A,E) returns in addition the matrix Z of generalized right eigenvectors of the pencil.
[al,be,Q,Z] = spec(A,E) returns in addition the matrix Q and Z of generalized left and right eigenvectors of the pencil.
Matrix eigeinvalues computations are based on the Lapack routines DGEEV and ZGEEV.
Pencil eigeinvalues computations are based on the Lapack routines DGGEV and ZGGEV.
// MATRIX EIGENVALUES A=diag([1,2,3]);X=rand(3,3);A=inv(X)*A*X; spec(A) // x=poly(0,'x'); pol=det(x*eye()-A) roots(pol) // [S,X]=bdiag(A); clean(inv(X)*A*X) // PENCIL EIGENVALUES A=rand(3,3); [al,be,Z] = spec(A,eye(A));al./be clean(inv(Z)*A*Z) //displaying the eigenvalues (generic matrix) A=A+%i*rand(A);E=rand(A); roots(det(%s*E-A)) //complex case