Dew MtxVec NET
TMtx.Eig Methods
Summary
Calculates matrix eigenvalues and eigenvectors.

Class
TMtx

Declaration
Function Eig(D: TVec; MtxType: TMtxType = mtGeneral): TMtx;

Description
Calculates the eigenvalues (stored in vector D elements) and optionally the eigenvectors (stored in matrix the columns of matrices VL and VR) of the calling matrix. The MtxType parameter indicates the calling matrix type. Depending the type of the calling matrix the Eig method will use specific optimized algorithm. If you don't know the type of the calling matrix, you can not omit the MtxType parameter. To determine the type of matrix use the DetectMtxType method, or set AutoMtxType property to True.

Depending on the MtxType parameter, the following algorithms will be used :

1) for symmetric positive definite matrix (mtSymPosDef, mtHermPosDef):
a) reduce the calling matrix to tridiagonal form A=Q*T*Q'
b) generate matrix Q
c) find eigenvalues and eigenvectors of the tridiagonal matrix T

2) for symmetric or hermitian matrix (mtSymetric, mtHermitian):
a) reduce the calling matrix to tridiagonal form A=Q*T*Q'
b) generate matrix Q
c) find eigenvalues and eigenvectors of the tridiagonal matrix T

3) for general matrix (mtGeneral):

A.) VectorForm = vfEig:
a) perform full balance of the calling matrix
b) reduce the calling matrix to Hessenberg form A=Q*H*Q'
c) generate matrix Q
d) find eigenvalues and left and/or right eigenvectors.
e) transform eigenvectors of the balanced matrix back to those of the original matrix.

B.) VectorForm = vfSchur:
a) perform user defined balance of the calling matrix
b) reduce the calling matrix to Hessenberg form A=Q*H*Q'
c) generate matrix Q
d) Find the real Schur form and optionally the eigenvectors Z*T*Z'. Matrix T is the real Schur form and Z are the eigen vectors.
e) transform the eigenvectors of the balanced matrix to those of the original matrix.
Matrix is in real Schur form, if it is upper quasi-triangular with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks are standardized in the form

[ a b ] [ c a ]

where b*c < 0. The eigenvalues of such a block are: a +/- sqrt(bc).

NOTE: The calling matrix Quadratic property must be true, otherwise an exception is raised.

This overloaded version calculates the calling matrix eigenvalues and stores them in the vector D. The TMtxVec.Complex and TVec properties of the vector D are adjusted automatically. The MtxType parameter specifies the calling matrix type. If MtxType parameter is omitted, the default value mtGeneral (general matrix) will be used, but for symmetric matrices the matrix type has to be specified explicitly, because the algorithm for general matrices will fail on the symmetric matrix. The matrix Q is not explicitly generated.

 See Also 
EigGen 

Example 1

var D: TVec; A,V: TMtx; begin CreateIt(D); CreateIt(A,V); try A.SetIt(2,2,False,[1,2, 2,4]); // 2x2, real matrix A.Eig(D,mtSymmetric); // or if eigenvectors are also required A.Eig(V,D,nil,mtSymmetric); // get left eigenvectors finally FreeIt(A,V); FreeIt(D); end; end;


Declaration
Function Eig(VL: TMtx; D: TVec; VR: TMTx = nil; MtxType: TMTxType = mtGeneral; VectorForm: TVectorForm = vfEig; Expand: boolean = True): TMtx;

Description
Calculate the calling matrix eigenvalues and eigenvectors. Store the eigenvalues in the vector D. The Complex and Length properties of the vector D are adjusted automatically. If VectorForm is vfEig, store the left eigenvectors in matrix VL and the right eigenvectors in the matrix VR. Either of the eigenvector matrices VL and VR can be nil to indicate that they are not required. If the are both nil, an exception is raised. In case of symmetric matrices only VL is checked. The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real and are stored in the columns of the VL and VR matrices. If VectorForm is vfSchur, it will store the real T form in the matrix VL and the eigenvectors Z in the matrix VR. VR can be nil, to indicate that eigenvectors are not required. If VL is nil an exception is raised. The Rows, Cols and Complex properties of matrices VR and VL are adjusted automatically. The MtxType parameter specifies the calling
matrix type. If MtxType parameter is omitted, the default value mtGeneral (general matrix) will be used, but for symmetric matrices the matrix type has to be specified explicitly, because the algorithm for general matrices will fail on the symmetric matrix.

Copyright 2008 Dew Research
http://www.dewresearch.com