Professional Documents
Culture Documents
1. T h e o r e t i c a l b a c k g r o u n d
The L R - T r a n s f o r m a t i o n is a m e t h o d for t h e c o m p u t a t i o n of eigenvalues of
matrices. I t has been described first in a C . R . - N o t e [lJ, b u t more details are
given in [2]. A d d i t i o n a l information is contained in E3J, [4].
The m e t h o d bases essentially on the fact, t h a t b y s t a r t i n g w i t h t h e given
m a t r i x A = A o , the prescription
of this is given in [2] a n d [3J. B u t even if this condition is fulfilled, the con-
vergence m a y be too poor for practical c o m p u t a t i o n s . F o r this reason a n d in
order to be able to t r e a t indefinite s y m m e t r i c matrices also, the simple decom-
p o s i t i o n - r e c o m b i n a t i o n p r o c e d u r e (1) m u s t be modified in t h e following w a y :
S t a r t w i t h A 0 = A, z0 = 0.
(2)
Choose Ys
decompose A s- y s I into RTRs I
I for s = 0 , t , 2 . . . . .
r e c o m b i n e R s a n d R T to As+ 1 = R s R ~ [
c o m p u t e zs+ 1 = Ys + zs J
B y p r o p e r choice of Ys (as large as possible, b u t still below the smallest eigen-
v a l u e of As) *% the last diagonal element a~S)~of A s will - - in general - - converge
* Editor's note. In this fascicle, prepublication of algorithms from the Linear
Algebra series of the Handbook for Automatic Computation is continued. Algorithms
are published in ALGOL60 reference language as approved recently b y IFIP [7].
Contributions in this series should be styled after the most recently published ones.
Inquiries are to be directed to the editor. F . L . BAUER, Mtinchen
** W i t h the exception of the first LR-step, A s is a product Rs_ 1 RT_I and therefore
at least positive semidefinite. Thus y, is usually positive, and z s increasing.
274 Handbook Series Linear Algebra
to zero and zs to the smallest eigenvalue of A. Exceptions from this rule are
matrices like that used as an example in w4.3 of [21 or matrices with invariant
subspaces spanned by coordinate plans. To avoid such exceptions, small per-
turbations m a y be applied at places where offdiagonal elements get exactly
zero (zero in the sense of the computer).
The pertubations are chosen small enough in order that the resulting eigen-
values undergo negligible changes.
A soon as the last diagonal element a ~ of A~ is smaller than eps, then z~ + a ~
deviates at most eps from an eigenvalue of A and therefore can be accepted as
an eigenvalue. The remaining eigenvalues are then found by erasing the last
row and column of A s and applying the same method to the deflated matrix. It
can be shown that the eigenvalues of the latter are the remaining eigenvalues
of the given matrix A, with errors of at most eps.
The tendency to choose for every LR-step an optimal y,, will sometimes lead
to a Ys which is so that A s -- y , I is no longer positive definite. Accordingly the
decomposition of A~ -- y f l will fail, which manifests itself b y an exit from decomp
through the exit parameter indef. In such a case the decomposition must be
repeated with a smaller value of y,. The occurrence of such a ,,failure of de-
composition" plays an important role in procedure LRCH, since it often allows
a quite narrow lower bound for the smallest eigenvalue of A s to be computed
([4J, formula (4), (5), (6), and theorem t) and therefore causes rather a reduction
than an increase of computing time.
2. Applicability
As already stated above, the program described here can be used for sym-
metric matrices only; but even then the method is in general too time-consuming
if the matrices are filled out with non-zero elements. For so-called "band-
matrices" however, (also called "striped" matrices in [2~), which occur frequently
when continuous problems are solved by difference methods, the LR-trans-
formation is superior to the methods of JACOBI and GIVENS and probably to
any other method. For this reason, the ALGOL-program described below is
adjusted to such "band-matrices" which are defined by the property
(3) aik=0 for li--kl>m ( i , k = t , 2 . . . . . n)
where m is some constant characterizing the width of the bandmatrix. Im-
portant cases are m-~ 2 (for vibrating beams), m = 3 (see [3J), whereas the case
m-----I (JACOBI matrices, or matrices arising from the method of GIVENS) are
treated more efficiently by the Quotient-difference-algorithm (see E5]). Full
matrices m a y he treated by the same program by setting m - - - - n - 1 (where n is
the order of the matrix) but the method can be recommended only if m is con-
siderably smaller than n.
The reason for the superiority of the LR-transformation for such matrices
is t h a t the property (3) is maintained whereas the methods of JACOBI and GIVENS
both destroy this property and therefore allow no saving of computing time in
such cases, Thus the computing time needed for computing eigenvalues of
matrices with property (3) is roughly proportional to n a for the methods of
JACOBI and GIVENS against m2n for the LR-transformation. Needless to say
The LR transformation method. RUTISHAUSERand SCHWARZ 275
ft 12 21 2
i
1
(4)
t 2 4 4 4
2 4 8 8 8
4 8 t6 16
8 t6 32
I)
should be capsized and fed as
(5) ( 16 t6
8 2,68
4
8
88
4
2
4
4
4
2
t
2
2
2
1
1
* The order in which the eigenvalues are computed may be chosen by proper
setting of the parameter lower.
** increase, if the eigenvalues are computed in descending order.
276 Handbook Series Linear Algebra
eps tolerance which decides when a new eigenvalue is computed (see state-
ment test) and thus determines the accuracy of the results.
lower Boolean variable indicating whether the eigenvalues should be computed
starting from the lower end (lower = true) or the upper end (lower =
false) of the spectrum.
in/orm procedure which may serve to convey in every LR-step certain informa-
tion concerning the progress of the computation to the program which
called LRCH. In addition it allows to influence the course of the com-
putation to some extent and to control the return to the calling program
(see [6]).
To this end the user of L R C H must -- somewhere outside L R C H --
declare the actual counterpart of procedure in/orm. The formal para-
meters of that procedure must be consistent with the actual parameters
in the procedure statement
in/orm (n, m, s, z, y, eps, a, l, lambda) result: (y, stop)
These actual parameters have the following meaning:
a) Input to procedure in/orm:
n current order of the matrix As*.
m same as parameter m of L R C H (see above).
s number of current LR-step (counting begins with 0).
z z~ of formula (2).
y coordinate shift for current LR-step as computed by procedure
LRCH.
eps same as parameter eps.
a elements of the matrix A s.
l number of already computed eigenvalues.
lambda already computed eigenvalues (this is an array).
b) Output of procedure in/orm:
y coordinate shift given by the user of L R C H in place of the y computed
by LRCH.
stop Boolean variable which -- if given the value t r u e -- causes immediate
exit from LRCH.
It is of course not compulsory to use all these parameters in the
body of procedure in[orm. For instance, if a user does not want to exert
control upon LRCH, he simply does not assign values to the variables y
and stop in the body of in]orm.
4. ALGOL-program
procedure L R C H (n, m, a, eps, lower, in/otto) result: (n, a, lambda) ;
real eps; integer n, m; boolean lower; array a, lambda;
procedure in/orm ;
c o m m e n t n ~ order of the given matrix, m = same as in formula (3),
a [k, 1"] ----elements of the given matrix, eps = tolerance for the acceptance
of an eigenvalue, lower indicates whether the eigenvalues should be com-
puted from above (false) or from below (true), in/orm is a procedure
which allows to interfere with the action of L R C H from outside, lambda [l~
are the eigenvalues to be computed;
c o m m e n t L R C H has no global parameters,
no nonlinear subscript expressions,
no own-variables or -arrays,
no recursive procedures;
begin
real z, y, h, ha, hb, phi, omega, x, u, v, w;
integer nt, l, s, p, pa, k, j, c/ ; boolean stop, g;
array r [ a : n + m , O : m ] ;
procedure recomb ;
comment uses global quantities n, m, r, eps, h, ha, hb, p, pa, a;
comment procedure recomb executes multiplication of R b y R transposed which
yields the matrix A and computes h, ha, hb which are respectively the
smallest of all, of the first n -- ! and of the first n -- 2 diagonal elements
of R. Furthermore it computes the serial numbers p, pa of the diagonal
elements h, ha;
begin
integer i, j, k;
h : : h a : : h b : = r [!, 0];
p:=pa::t;
for k : : l step ! until n do
begin
hb :=ha; ha :=h; pa : = p ;
if r[k, 0] < h then begin h : = r [ k , 0!; p : = k end;
f o r i : = O step I until m do
begin
a [k,i] : = o ;
for i : = i step I until m do
aEk, i] :--aEk, il +rEk, CJ • + i, r ;
perturb: if a [k,/'] = 0 A k + i ----<n t h e n a [k, i] : ----0.00t • eps ;
c o m m e n t applies small pertur-
bations whenever off-
diagonal elements of
the recombined matrix
get exactly zero. This
is to avoid exceptions
from general rule t h a t
the last diagonal ele-
ment of A converges
The LR transformation method. RUTISHAUSER and SCHWARZ 279
if y = 0 t h e n
zero: y : = -- eps • 6
e l s e if y < 0 t h e n
neg: y:=lO•
else if c/= 3 then
c/3: y:=O
else if k ~ n - - 2 t h e n
early: b e g i n c o m m e n t decomposition fails for y > 0 and k < n - - I ("early
failure"), early increases omega and decreases y, but
a resulting negative y would be replaced b y zero;
omega : : (omega + t) • (omega + 1) ;
y :----y/omega -- eps;
if y < 0 t h e n g o t o c/3
e n d early
else
late: begin comment decomposition fails only for k - - - - n - - I or k : n ("late
failure"), a lower b o u n d for the spectrum of A is here
used to c o m p u t e the new y;
if k = n -- t then
uvw t: b e g i n c o m m e n t decomposition fails for k = n - - I . Computation of
u, v, w, used in statement common to find a lower b o u n d for
the smallest eigenvalue;
u :=a/n, O]--r[n, O]--y;
v::a[n-- l, l ] - - r [ n - - l, 1];
W:=X
e n d uvw t ;
if k : n t h e n
uvw 2 : begin
if e#s + x > O t h e n
margin: begin c o m m e n t if the decomposition fails on the last diagonal
element b y a margin less than eps, then we set r In, O]
: 0 . This simulates a success, but does not change any
eigenvalue by more than eps;
r/n, O] : : 0 ;
g o t o rec
e n d margin;
u:----x+r[n--l, t I • t, t l ;
v::r[n--t, O] x r [ n - - l , 1];
w : -- r [ n -- 1, O] X r [ n -- t, O]
e n d uvw 2;
c o m m e n t c o m p u t a t i o n of a new y for which (except when roundoff-
errors occur) the new decomposition should succeed. A second late
failure is indicated b y the Boolean variable g, and causes a stronger
decrease of y. If the new y would get negative, then we proceed to
statement early;
The L R transformation method. RUTISHAUSERand SCHWARZ 281
if p >=n -- I t h e n p h i : : 1 ;
if n < 2 then goto advance
end eigen ;
newy: begin c o m m e n t an u p p e r bound h for the smallest eigenvalue of A
is c o m p u t e d from u, v, and w then multiplied with the risk
factor phi to yield the new y;
if p-----n then
begin
u :----a [n, 0];
v:=a[n--t, t];
w : : a [ n - - t, 0];
ha::u•
end
else
begin
u : = r E P + 1, o] xr[p+t, o];
v : = r [ p , t] x r [ p + 1 , 0];
w : = r [ p , o] x r [ p , o] + r[p, t] x r [ p , t ] ;
ha : = (r [p, O] • [p + 1,0]) • (r [p, O] • [p + t, 0]);
end;
h : = ha/( (u + w)/2 + sqrt ((u -- w) • (u -- w) /4 + v • ;
y :=h •
end newy ;
trial: begin c o m m e n t serves to prevent (as m u c h as possible) failures of
decomposition in the next L R - s t e p b y trying to decompose
a s u b m a t r i x of order nt of the m a t r i x A -- y • I hereby nt is
considerably smaller than n and therefore requires not m u c h
c o m p u t i n g time. If t h a t trial decomposition fails y and
possibly omega is adjusted;
decomp (n -- nt + t) exit: (trilail) ;
g o t o advance;
tri/ail: if (k>=n-- t)A ( x > -- y/2) then
y:=y+x
else
begin
omega : = omega + t ;
y::0.8•
end
end trial;
advance: s := s + t ; c o m m e n t end of one L R - s t e p ;
g o t o iteration
end iteration;
On the other hand, as mentioned in section t, any deflation step can change
any eigenvalue by at most eps, since deflation takes place only if the last
diagonal element of the matrix A S is smaller than eps.
The total error of one eigenvalue is then estimated by accumulating the con-
tributions of all LR- and deflation-steps until the moment the eigenvalue is
actually determined, plus one extra half unit of the last place. However, this
uppermost error is in practice almost never attained; not only for statistical
reasons, but also because it would be unusual if all numbers entering the cal-
culations had the maximum exponent and therefore the roundoff-errors produced
by many operations are negligible.
Since'the /-th eigenvalue of A is obtained from the n - - / + t - t h diagonal
element of the matrix A, after certain numbers have been added to and sub-
tracted from it in every LR-step, it follows that the accuracy of lambda [lJ is
dependent on the size of the n - - I + t-th diagonal elements of the matrices A s
( s = 0 , t . . . . ). It is therefore advisable to avoid -- e.g., by proper rearrangement
of the matrix A -- these values getting too large. An example of this tendency
is the capsized matrix considered in section 2. Indeed, if the eigenvalues are
computed from below, the smaller ones will be obtained more accurately from
(5) than from (4), although here the improvement will not be dramatic.
A more involved example of this kind is the matrix
6--4 t
--4 6 --4 t
t --4 6 --4 I
t --4 6 --4 I
(8) A =
I --4 10 7 - - 4 1
r --4 6 --4 t
I --4 6 --4
t --4 6_
(Rough model of vibrating beam with an elastic but rather stiff intermediate
support.) Some of the eigenvalues of this matrix will be computed rather in-
accurately b y procedure LRCH, but a rearrangement to
t0 7 --4 --4 I t
--4 6 I --4 0 I
--4 t 6 o --4 0 t
I --4 0 6 0 --4 0 t
(9) A=
1 0 --4 0 6 0 --4 0
I 0 --4 0 6 0 --4
t 0--4 0 6 0
t 0--4 0 6_
first: begin
integer x;
array larnbda LI : 5] ;
procedure in/otto(n, m, s, z, y, eps, a, l, lambda) result: (y, stop);
real z, y, eps; i n t e g e r n, m, s, l;
Boolean stop; a r r a y a, lambda ;
comment uses global variable x;
begin
if x = l then goto exit;
line; print (l); print (lambda Ill) ;
x::l;
stop : = (1= 5);
exit : e n d in/orrn ;
x:=0;
L R C H (n, m, a, eps, true, in/orm) result: (n, a, lambda) ;
end/irst;
(The variables n, m, a, eps, and the procedures line and print are assumed to
be global to the block first.)
c) The following example shows a block second (being part of a larger program)
which computes all negative and the lowest positive eigenvalues of a bandmatrix C
whose elements are all one's, but with arbitrary m and n (e.g. for n----6, m = 2 ) :
1 1 1
1 1 t t
(1o) c=
i' ' 11
1 t
t
t
t
1
I
!
1
I 9
The example shows also how the knowledge of a lower bound for the spectrum
of the matrix C (namely 1 - - 2 x m) may be used to speed up the computation,
simply by enforcing in the first LR-step a coordinate shift of I - - 2 • m in place
of the value 0 given by LRCH. The variables n and m are assumed to be global
to the block second, and their values to be given upon entry to the block. Further-
more also the alray cp of the computed eigenvalues is global to the block second.
* It has to be noted that in this example for simplicity the freedom of choosing
arbitrary names for the actual parameters of LRCH and the formal parameters of
inform has not been used.
286 Handbook Series Linear Algebra
second: begin
integer i, k;
array c[t :n, 0:m];
procedurettt(a, b, c, d, e, [, g, h, i) result: (e, ]) ;
real d, e, ]; integer a, b, c, h;
Boolean i; array g, i;
begin
ife=O t h e n e : = l - - 2 •
ifh~=0 theni : = i [ h ] > 0
end ttt ;
program: fork:=t stepl untiln do
for?':=0 step ! until m do
i f k + / ' < n t h e n c [ k , / ] : = t elsec[k, j J : = O ;
L R C H (n, m, c, 10 8, true, ttt) result: (n, e, cp) ;
end second;
d) Block third shows how the coordinate shifts can be suppressed altogether
(this m a y be wanted in certain applications which have nothing to do with eigen-
value computations), and how the successive matrices At, A~, A.~. . . . produced
b y the LR-transformation can be made available to the user of L R C H . In this
example the variables n, m, p and the array a are supposed to be global to block
third and their values given upon entry to the block. The integer valiable p
denotes the number of LR-steps to be carried out.
third: begin
array pt II : n, 0: m, l : p], lambda It : nj ;
procedure in/arm(n, m, s, z, y, eps, a, l, lambda) result: (y, stop);
real z, y, eps; i n t e g e r n, m, s, l;
Boolean stop; a r r a y a, lambda ;
comment uses global array pt;
begin integer?', k;
y:=O;
ifs~O then
f o r k : = 1 step1 untiln do
f o r i : = O stept until m do
pt [k, i, s] : = a [k, il ;
stop : = (s = p)
end in/arm;
L R C H (n, m, a, 10 -z~ t r u e , in/arm) result: (n, a, lambda) ;
unspeccomp :
end third;
After the label unspeccomp, the user m a y fill in a program which makes use
of the array pt, which consists of the elements of the matrices A, for s = t, 2 . . . . . p.
8. Testresults
Procedure L R C H has been used on a floating decimal computer with tt-digit
mantissa to compute the eigenvalues of the following test matrices:
The LR transformation method. RUTIStIAUSERand SCHWARZ 287
a) The nullmatrix with n = 10, m = 3, eps = lo-- 1O, lower = t r u e . The resulting
eigenvalues ranged from -- 0.000000000110 -- 3 up to + 0.00000000041o-- 3 (the
deviations are mainly due to statement perturb) and it required a total of t 5 LR-
steps to compute them all.
b) A diagonal matrix with n = t O , m = 3, eps=lo--10, lower=true, the k-th
diagonal element being k. This is obviously an example where slow convergence
must be expected because of the inverted order of the diagonal elements; in fact
it can converge only b y virtue of statement perturb. The resulting eigenvalues
were
1.000 000 000t after 10 LR-steps
2.000 000 0007 after 21 LR-steps
(11) 3.000 000 000t after 28 LR-steps
4.000 000 0020 after 35 LR-steps
(12) (symmetric) . . . .
1
t t
3 t 1
6 3 1
6 2
5
4.03456 80076
4.00000 00000
4.05284 t 5893
4.24480 87250
4.61803 39887
5.20004 56t31
6.00000 00000
7.00656 44924
8.18769 27228
9.49235 53748
t.0854t 0t9661ot
1.2t96t 524221ot
t.34375 67947101
t .44999 435911o1
t.53140 10508101
1.58255 39606101
References
[1] RUTISHAUSER, H. : Une m~thode pour la dGtermination des valeurs propres d ' u n e
matrice. Compt. rend. Paris 240, 34 (1955).
[2] -- Solution of E i g e n v a l u e P r o b l e m s w i t h the LR-transformation. N a t Bur.
Standards, AMS 49, 47--81 (1958).
[3] HEILBRONNER, E., H. RUTISHAUSER U. F. GERSON: Verfahren zur p r o g r a m m -
gesteuerten Berechnung der Eigenwerte eindimensionaler Molekel-Modelle.
H e l v e t i c a Chemica A c t a 42, 2285--2303 (1959).
~4] RUTISHAUSER, H . : ~ b e r eine kubisch k o n v e r g e n t e V a r i a n t e der L R - T r a n s f o r m a -
tion. ZAMM 40, 4 9 - - 5 4 (1960).
[5] -- Stabile Sonderftklle des Quotienten-Differenzen-Algorithmus. Numer. Math.
5, 95--112 (1963).
[6] - - Interference w i t h an ALGoL-procedure. A n n u a l R e v i e w in A u t o m a t i c Pro-
g r a m m i n g , 2, 67--75 (196t).
[7] BACKUS, J. W., F. L. BAUER, J. GREEN, C. KATZ, J. MCCARTHY, P. NAUR, A. J.
PERLIS, H. RUTISHAUSER, N. SAMELSON, B.VAuQUOIS, J. H. WEGSTEIN, A. VON
WIJNGAARDEN and M. WOODGER" Revised report on the algorithmic language
ALGOl:. 60. Numerische M a t h e m a t i k 4, 420--453 (1963).
[8] SCHWARZ H. R. : I n t o d r u c t i o n to ALGOL. Comm. of the ACM 5 (1962).
EidgenOssische Technische H o c h s c h u l e
I n s t i t u t fiir A n g e w a n d t e M a t h e m a t i k
Ztirich