Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
spec
eigenvalues of matrices and pencils
Syntax
evals=spec(A) [R,diagevals]=spec(A) evals=spec(A,B) [alpha,beta]=spec(A,B) [alpha,beta,Z]=spec(A,B) [alpha,beta,Q,Z]=spec(A,B)
Arguments
- A
real or complex square matrix
- B
real or complex square matrix with same dimensions as
A
- evals
real or complex vector, the eigenvalues
- diagevals
real or complex diagonal matrix (eigenvalues along the diagonal)
- alpha
real or complex vector, al./be gives the eigenvalues
- beta
real vector, al./be gives the eigenvalues
- R
real or complex invertible square matrix, matrix right eigenvectors.
- L
real or complex invertible square matrix, pencil left eigenvectors.
- R
real or complex invertible square matrix, pencil right eigenvectors.
Description
- evals=spec(A)
returns in vector
evals
the eigenvalues.- [R,diagevals] =spec(A)
returns in the diagonal matrix
evals
the eigenvalues and inR
the right eigenvectors.- evals=spec(A,B)
returns the spectrum of the matrix pencil A - s B, i.e. the roots of the polynomial matrix s B - A.
- [alpha,beta] = spec(A,B)
returns the spectrum of the matrix pencil
A- s B
,i.e. the roots of the polynomial matrixA - s B
.Generalized eigenvalues alpha and beta are so that the matrixA - alpha./beta B
is a singular matrix. The eigenvalues are given byal./be
and ifbeta(i) = 0
the ith eigenvalue is at infinity. (ForB = eye(A), alpha./beta
isspec(A)
). It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0, and even for both being zero.- [alpha,beta,R] = spec(A,B)
returns in addition the matrix
R
of generalized right eigenvectors of the pencil.- [al,be,L,R] = spec(A,B)
returns in addition the matrix
L
andR
of generalized left and right eigenvectors of the pencil.- [al,be,Z] = spec(A,E)
returns the matrix
Z
of right generalized eigen vectors.- [al,be,Q,Z] = spec(A,E)
returns the matrices
Q
andZ
of right and left generalized eigen vectors.
For big full / sparse matrix, you can use the Arnoldi module.
References
Matrix eigenvalues computations are based on the Lapack routines
DGEEV and ZGEEV when the matrix are not symmetric,
DSYEV and ZHEEV when the matrix are symmetric.
A complex symmetric matrix has conjugate offdiagonal terms and real diagonal terms.
Pencil eigenvalues computations are based on the Lapack routines DGGEV and ZGGEV.
Real and complex matrices
It must be noticed that the type of the output variables, such as evals or R for example, is not necessarily the same as the type of the input matrices A and B. In the following paragraph, we analyse the type of the output variables in the case where one computes the eigenvalues and eigenvectors of one single matrix A.
Real A matrix
Symmetric
The eigenvalues and the eigenvectors are real.
Not symmetric
The eigenvalues and eigenvectors are complex.
Complex A matrix
Symmetric
The eigenvalues are real but the eigenvectors are complex.
Not symmetric
The eigenvalues and the eigenvectors are complex.
Examples
// 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(3,3)-A) roots(pol) [S,X]=bdiag(A); clean(inv(X)*A*X) // PENCIL EIGENVALUES A=rand(3,3); [al,be,R] = spec(A,eye(A)); al./be clean(inv(R)*A*R) //displaying the eigenvalues (generic matrix) A=A+%i*rand(A); E=rand(A); roots(det(A-%s*E)) //complex case
See also
- poly — Polynomial definition from given roots or coefficients, or characteristic to a square matrix.
- det — determinant
- schur — [ordered] Schur decomposition of matrix and pencils
- bdiag — block diagonalization, generalized eigenvectors
- colcomp — column compression, kernel, nullspace
- dsaupd — Interface for the Implicitly Restarted Arnoldi Iteration, to compute approximations to a few eigenpairs of a real and symmetric linear operator This function is obsolete. Please use eigs
- dnaupd — Interface for the Implicitly Restarted Arnoldi Iteration, to compute approximations to a few eigenpairs of a real linear operator This function is obsolete. Please use eigs
Report an issue | ||
<< schur | Eigenvalue and Singular Value | sva >> |