Page 125 - Compact Numerical Methods For Computers
P. 125
114 Compact numerical methods for computers
Algorithm 26. Eigensolutions of a complex matrix by Eberlein’s method (cont.)
begin
itcount := itcount+1; {safety loop counter}
tau := 0.0; {convergence criteria}
diag := 0.0; {to accumulate diagonal norm}
for k := l to n do
begin
tem := 0;
for i := 1 to n do if i<>k then tern := tem+ABS(A[i,k])+ABS(Z[i,k]);
tau := tau+tem; tep := abs(A{k,k])+abs(Z[k,k]);
diag := diag+tep; {rem accumulate diagonal norm}
Rvec[k] := tem+tep;
end; {loop on k}
writeln(‘TAU=’,tau,‘ AT ITN ’,itcount);
for k := 1 to n1 do {interchange rows and columns}
begin
max := Rvec[k]; i := k; k1 := k+1;
for j := k1 to n do
begin
if max<Rvec[j] then
begin
max := Rvec[j]; i := j;
end; {if max<Rvec[j]}
end; {loop on j}
if i<>k then
begin
Rvec[i] := Rvec[k];
for j := 1 to n do
begin
tep := A[k,j]; A[k,j] := A[i,j]; A[i,j] := tep; tep := Z[k,j];
Z[k,j] := Z[i,j]; Z[i,j] := tep;
end; {loop on j}
for j := l to n do
begin
tep := A[j,k]; A[j,k] := A[j,i]; A[j,i] := tep; tep := Z[j,k];
Z[j,k] := Z[j,i]; Z[j,i] := tep; tep := T[j,k]; T[j,k] := T[j,i];
T[j,i] := tep; tep := U[j,k]; U[j,k] := U[j,i]; U[j,i] := tep;
end; {loop on j}
end; {if i<>k}
end; {loop on k}
if tau>=l00.0*eps then {note possible change in convergence test from
form of Eberlein to one which uses size of diagonal elements}
begin {sweep}
mark := true;
for k := 1 to n1 do {main outer loop}
begin
k1 := k+1;
for m := k1 to n do {main inner loop}
begin
hj := 0.0; hr := 0.0; hi := 0.0; g := 0.0;
for i := l to n do
begin
if (i<>k) and (i<>m) then