SetEigenvalAccuracy, GetMaxEigenval, GetMinEigenval -- estimation of extremal eigenvalues
#include <laspack/eigenval.h> void SetEigenvalAccuracy(double Eps); double GetMinEigenval(QMatrix *Q, PrecondProcType PrecondProc, double OmegaPrecond); double GetMaxEigenval(QMatrix *Q, PrecondProcType PrecondProc, double OmegaPrecond);
The algorithm used is based on the Lanczos method for symmetric matrices. Eigenvalues of non-symmetric matrices are estimated by means of Q^T Q.
For singular matrices, if the null space has been specified, the zero eigenvalue is not considered.
If any procedure for preconditioning is given by the parameter PrecondProc (i.e. if PrecondProc != NULL), eigenvalues are computed for the preconditioned matrix. The procedure used should have the prototype
Vector *(*PrecondProcType)(QMatrix *, Vector *, Vector *, double)The parameter OmegaPrecond will be passed as a relaxation parameter to the preconditioner.
Each of the procedures GetMinEigenval and GetMaxEigenval causes the estimation of both, minimum and maximum eigenvalues. They are stored together with the parameters PrecondProc and OmegaPrecond in connection with the matrix Q, and are returned at the next call of above routines if the same parameters are used. Therefore, the extremal eigenvalues need not to be stored additionally, but could be queried on demand without extra computational costs.
The implementation of the Lanczos method follows algorithms described in:
G. Golub, C. van Loan: Matrix Computations, second edition, The Johns Hopkins University Press, Baltimore, 1989.
eigenval.h ... header file
eigenval.c ... source file
In the following code fragment, condition numbers of a matrix and their preconditioned variants are estimated.
QMatrix A; double LambdaMax, LambdaMin; size_t Dim; Dim = ... ; Q_Constr(&A, "A", Dim, True, Rowws, Normal, True); /* generation of the matrix A */ ... printf("Condition numbers of the matrix %s:\n\n", Q_GetName(&A)); LambdaMax = GetMaxEigenval(&A, NULL, 1.0); LambdaMin = GetMinEigenval(&A, NULL, 1.0); printf("without preconditioning: k = %12.5e\n", LambdaMax / LambdaMin); LambdaMax = GetMaxEigenval(&A, JacobiPrecond, 1.0); LambdaMin = GetMinEigenval(&A, JacobiPrecond, 1.0); printf("with Jacobi preconditioning: k = %12.5e\n", LambdaMax / LambdaMin); LambdaMax = GetMaxEigenval(&A, SSORPrecond, 1.0); LambdaMin = GetMinEigenval(&A, SSORPrecond, 1.0); printf("with SSOR preconditioning: k = %12.5e\n", LambdaMax / LambdaMin); LambdaMax = GetMaxEigenval(&A, ILUPrecond, 1.0); LambdaMin = GetMinEigenval(&A, ILUPrecond, 1.0); printf("with ILU preconditioning: k = %12.5e\n", LambdaMax / LambdaMin); Q_Destr(&A);