procedure eigenvalues(N,A,EV); value N; integer N; real array A,EV;
Eigenvalues of a real symmetric matrix A[1:N,1:N] by Householder's method. They are arranged in descending order in EV[1:N]. Only the lower triangle of A need be input.
procedure iterjacobi(A,N,R,UT,PREC); integer N; real PREC; real array A,R,UT;
Eigenvalues and normalised eigenvectors of a real symmetric matrix A [1:N,1:N] by Jacobi's method. The eigenvalues are in R[1:N] and the eigenvectors in UT[1:N,1:N] such that the jth row of UT is the eigenvector corresponding to R[j]. The iteration is terminated when
(Σi,j | A[i,j] |) / ( Σi A[i,i] ) ≤ PREC.
10-7 is a reasonable value for PREC. Only the upper triangle of A need be input. Remarks: Jacobi's method is considerably slower than Householder's as far as the eigenvalues are concerned but does have the advantage that an orthogonal set of eigenvectors is produced automatically in cases of multiple roots. Not recommended for N > 50.
procedure jacobi(N,AR,AI,LAMBDA,VR,VI,EPSILON); integer N; real EPSILON; real array AR,AI,LAMBDA,VR,VI;
Eigenvalues and normalised eigenvectors of the complex Hermitean matrix AR + iAI by Jacobi's method. Only the upper triangle need be input. The eigenvector corresponding to the eigenvalue LAMBDA[j] is the jth column of VR + iVI. Declare AR,AI,VR,VI [1:N,1:N], LAMBDA [1:N]. The iteration is terminated when
( Σi<j (| AR[i,j] | + | AI[i,j] | ) ) / Σi=1 N | AR[i,i] |
is less than EPSILON ( = 10-7 say ). Not recommended for N > 20.
procedure rutisvalues(N,A,LAMBDAR,LAMBDAI,COUNT,FAULT,PREC); integer N,COUNT; array A,LAMBDAR,LAMBADAI; label FAULT; real PREC;
Real or complex eigenvalues of a general real N × N matrix A by Wilkinson quasi-triangulation followed by Rutishauser's method. Real and imaginary parts are stored in LAMBDAR,LAMBDAI[1:N]. The procedure exits to FAULT if a precision determined by PREC is not achieved af COUNT iterations. We suggest PREC = 10-10 and COUNT=50. The procedure is quite fast but multiple eigenvalues are found to less precision.
procedure hymanvalues(N,A,LAMBDAR,LAMBDAI,M,EPS); integer N,M; array A,LAMBDAR,LAMBADAI; real EPS;
Real or complex eigenvalues of a general real N × N matrix A by Householder quasitriangulation followed by Hyman's method. Real and imaginary parts in LAMBDAR,LAMBDAI[1 N]. The procedure finds M ≤ N eigenvalues, depending on what EPS is (it should find all of them as long as EPS is not set too small). EPS = 10-8 is small enough for practical purposes. The method is even more accurate than rutisvalues but 3-4 times slower for the same tolerance.
procedure eigenvec(N,A,LAMBDA,VEC,EPS,IMPOSSIBLE); integer N; real EPS; array A,LAMBDA,VEC; label IMPOSSIBLE;
Eigenvectors of a general real N × N matrix A with real eigenvalues. The procedure reduces A to tridiagonal form and calculates the eigenvectors by inverse iteration. If the reduction is singular an exit to IMPOSSIBLE is made. The eigenvalues are arranged in decreasing order in LAMBDA [1:N] and the eigenvectors are the corresponding columns of VEC[1:N,1:N]. We suggest EPS = 10-10.
There may be some instability in the reduction to tridiagonal form although this is not very common.