You are on page 1of 17

Numerische Mathematik 5, 273-- 289 (1963)

Handbook Series Linear Algebra*


The LR transformation method for symmetric matrices
Contributed b y
H. RUTISHAUSER and H. R. SCHWARZ

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

decompose A s into t h e p r o d u c t L~R s }


(t) recombine L s a n d R s b y forming their p r o d u c t As+ 1 = R s L s , s = 0 , 1, 2 . . . .

generates an infinite sequence of similar matrices A 1, A s . . . . which u n d e r certain


conditions converge to a t r i a n g u l a r or diagonal m a t r i x Ai,t.
If A is s y m m e t r i c a n d positive definite, a n d if the d e c o m p o s i t i o n of A s into
L s R s is such t h a t L s is a lower t r i a n g u l a r m a t r i x and R s is the t r a n s p o s e of L s
for a n y s (CHoLESKI-decomposition), then lira A s exists a n d is diagonal. A p r o o f
S --> Oo

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

this is quite decisive if m<<n, as it happens frequently for coefficient


matrices of difference equations.
There is an other advantage of the LR-transformation, which is extremely
important for applications to difference equations: The LR-transformation com-
putes the eigenvalues in strictly increasing (decreasing)* order, beginning with
the lowest (highest) eigenvalue. Since for problems of the type mentioned only
a few of the lowest eigenvalues have physical meaning, the computation may
be stopped after delivery of these few eigenvalues, which again saves comput-
ing time.
There is another point to be considered: If the size of the diagonal elements
varies considerably within the original matrix, the user of the program should -- if
this is possible without destroying property (3) -- reorder the rows and columns
of the matrix in such a way that the diagonal elements akk tend to decrease**
with increasing k. Of course this need not necessarily be done and sometimes
is impossible without destroying property (3), but then the convergence may
be slow. But in any case a matrix like

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

into the machine.


Furthermore, it must be noted that procedure L R C H described below is
designed for floating point arithmetic. It may not work properly if executed
with fixed point arithmetic or with an arithmetic which uses the same exponent
for all components of an array.

3. Formal parameter list


3.1. lnput to the procedure:
n order of the matrix A.
m m of formula (3).
a elements of the matrix A. They must be given in accordance with section 5.

* 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.

3.2. output o/procedure L R C H :


lambda eigenvalues computed by the procedure. The subscript of this array
counts the eigenvalues -- beginning with t -- in the order in which they
are computed. Except for oscillations of at most eps, this order isstrictly
monotonic. In case of premature exit from L R C H (caused by stop =
true) not all eigenvalues are computed.
* During the execution of LRCH, the order of file matrix A is reduced by t with
every computed eigenvalue. Here and further n means always the order of the reduced
matrix and therefore may be smaller than the originally given value of n.
The LR transformation method. RUTISHAUSERand SCHWARZ 277

The input parameters a and n are changed during execution of L R C H


insofar as the latter produces a new b a n d matrix A. The eigenvalues
of the new A are, approximately, those eigenvalues of the given matrix,
which have not yet been c o m p u t e d b y L R C H and therefore are not
contained in the a r r a y Iambda. The new n is then the order of the new
b a n d matrix A and therefore differs from the given n b y the n u m b e r
of eigenvalues c o m p u t e d b y L R C H . Sometimes this is the only informa-
tion on the actual n u m b e r of components of the array lambda.

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 decomp(en) exit: (inde/) ;


integer en ; label inde/;
c o m m e n t uses global quantities n, m, a, y, r, x, k;
c o m m e n t procedure decomp executes the triangular decomposition
of the matrix A -- y • I from the en-th diagonal element
downwards into two transposed factors (method of
CHOLESKI). In case en ~ t , and if the decomposition
succeeds, the resulting matrix R corresponds to formula (2).
Otherwise the r Fi, k I are not further used;
begin
integer i, j;
for k:~-en step I until n + m do
fori:-----O step I until m do r[k, jl : = 0 ;
for k : = en step I until n do
begin
x :----a[k, 01 - t E L 03 - y ;
test: if x ~ 0 then goto inde[; c o m m e n t failure of decomposi-
tion, shown b y a non-positive
x, causes immediate exit from
278 Handbook Series Linear Algebra

decomp. After that the values of x


and k are available in the main
b o d y of L R C H and serve to indi-
cate where and b y what margin the
decomposition failed;
r [k, 0] : - sqrt (x) ;
for i : = 1 step t until m do
r [k, iJ : = (~ [k, i] - r [k, i])/r [k, o] ;
for 1' : :
1 step I until m do
for i : =?" step ! until m do
r[k +i, i - i ] :=r [k +i, i - i l +rEk, iJ • ij
end k
end decomp ; comment if the execution of de-
comp terminates here, the de-
composition has been successful;

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

to zero for s to in-


finity;
end i
end k
end recomb ;

Begin o/ program proper:


z:--y:----0; s:=/:=0; omega:=phi:=0.5;
nt : = entier (1.5 x sqrt (n) ) ; pa : = l ;
if7 lower then
for k : = 1 step t until n do
for j : = O step t until m do
a Ek, i~ : = -a[k,i~; comment replace A b y --A, if t h e
eigenvalues are w a n t e d
in decreasing order. This
inversion is c o m p e n s a t -
ed for in s t a t e m e n t eigen
a n d exit;
iteration:
begin comment c o m p o u n d s t a t e m e n t iteration describes one full L R - s t e p
including c o u n t e r m e a s u r e s against inefficient r u n n i n g of LRCH. T h e
integer v a r i a b l e s c o u n t s the executions of iteration;
g:=stop : = false;
in/orm (n, m, s, z, y, eps, a, l, lambda) result: (y, stop);
cl : = 0 ;
if n = 0 V stop t h e n g o t o exit;
if n = t then goto eigen;

dec: decomp (1) exit: (~all); comment d e c o m p o s i t i o n of t h e


full m a t r i x A - - y • I .
I n case of failure t h e
decomposition must be
r e p e a t e d w i t h a smaller
value of y. This is done
in one of t h e following
s u b - s t a t e m e n t s of s t a t e -
ment/ail;
goto rec ;
/ail: begin comment after a failure with y = 0 , we t r y it again w i t h a s l i g h t l y
n e g a t i v e y (zero). A f t e r failure w i t h a n e g a t i v e y we
m a k e y more negative (neg). A f t e r 3 fruitless a t t e m p t s
to d e c o m p o s e (with positive values of y) we choose
y=0 (cl 3);
c / : = cl + ~ ;
c o m m e n t c/counts t h e failures of
decomp in the same
LR-step;
280 Handbook Series Linear Algebra

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

common: h : ~- (u + w)/2 -- sqrt ((u -- w) • (u -- w)/4 + v • v) ;


if w > u then h : = u - - v • v / ( w - - h) ;
h : = (if g t h e n 0.99999 • y -- eps else y) + h;
g : = true;
if h < 0 then goto early;
y:=h;
if c~ = 1 then omega : = omega/(omega + 1) ;
end late;
g o t o dec
end/ail;
rec: recomb ;
z:=z+y;

newphi: begin c o m m e n t phi and omega govern the c o m p u t a t i o n of the new


coordinate shift (for the next LR-step) in c o m p o u n d state-
ment newy: phi is t h e " r i s k factor" which lies always between 0
and I and is later multiplied b y an appropriate upper b o u n d
for the lowest eigenvalue, omega governs the changes of phi.
omega itself is increased b y an early failure, decreased b y a
late failure or b y immediate success (statement c/O). I n all
cases a further decrease occurs if the last or the last two
diagonal elements of the matrix R are smaller t h a n the others;
c/o: if c / = 0 then
omega : = (omega/(omega + t.5)) x (omega/(omega + t. 5));
omega : = 2 • • • x h a + hb x h b ) ;
phi : = 0.998 • x phi x (1 -- omega) + omega)
end n e w p h i ;

if abs (a In, 0]) < eps then


e/gen- begin c o m m e n t assigns the (approximate) eigenvatue to lambda Ell
(inverting its sign if needed). Then the matrix A is deflated.
The rather daring choice of phi----I in case p > n - - 2
usually causes late failure in the next LR-step and thus
accelerates the computation of the next eigenvalue. The con-
ditional j u m p to advance at the end of eigen serves, in connec-
tion with the conditional jumps to eigen and exit (in front of
the label dec), t h a t procedure in/orm is entered also after the
determination of the eigenvalues lambda In -- t ] and lambda In t ;
l:=l+l;
lambda ~l~ : = z + a In, O] ;
if-1 lower then lambda Ill : = -- lambda Ill ;
f o r i : = 0 step 1 until m do
i f i < n then a In --i, i] : = 0 ;
n:=n--t;
nt : ----entier (1.5 • sqrt (n)) ;
phi : -= omega : = O. 5 ;
p:=pa;
Numer. Math. Bd. S 19
282 Handbook Series Linear Algebra

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;

exit: for k : = l step t until n do


begin c o m m e n t if not all eigenvalues h a v e been computed, i.e. if
the c o m p u t a t i o n arrives here with n & 0, then s t a t e m e n t exit
reestablishes from the current m a t r i x A a m a t r i x whose eigen-
The LR transformation method. RUTISHAUSERand SCItWARZ 283

values are (approximately) the remaining eigenvalues of the


given matrix A ;
a[k, O] : = z + a [ k , 0];
if 7 lower then
f o r i : = 0 step I until m do
a [k, i] : = - a [k, i]
end k
end LRCH

5. Organisational and notational details


In order to take advantage of the symmetry and the property (3) of the
matrix A, whose eigenvalues must be computed, an unusual arrangement of the
matrix elements is required: The element ak,~+i (in the usual notation) which is
in the k-th row and /" columns to the right of the diagonal element, must be
denoted by a~,i.
Thus the matrix A is completely defined by the elements

(6) ak, j (k = t . . . . . n; i = 0 . . . . . m).


It must be noted however, that the matrix A is fully defined only if in addition
those elements are given (as zeros) for which k + i > n,which therefore lie outside
the matrix frame in the usual notation.
Example: The matrix (5) appears as the following array
32 16 8
16 8 4
(7) 8 4 2
4 2 t
2 t 0
t 0 0
I t has to be noted, furthermore, that the ALGoL-program does not distin-
guish between the matrices A s ( s = 0 , t, 2 . . . . ) occuring in formula (2); i.e. inside
p r o c e d u r e LRCH the k,k+/'-element of all those A s is denoted b y ak, i. The
same holds for the elements rk, i of the matrices Rs, but here the subscript k is
running from t to m + n.
The index s counting the LR steps is atso inside the procedure denoted by s,
but the quantities Ys and Zs which are used in formula (2) are not distinguished
with respect to s and therefore denoted by y and z respectively,

6. Discussion of numerical properties


The accuracy of the computed eigenvalues depends o11 the precision of the
computer and on the tolerance eps.
Tile influence of the roundoff-errors is governed by the size of the largest
numbers in the matrices A s, As--y~ 1 and As+ 1, and by the size of zs. By a
reasoning proposed b y J. WILKINSO~ we can estimate that the s-th LR-step can
falsify any eigenvalue at most by 2 (m + t) 2 units of the last place of the largest
of these numbers, including the errors that come in through zs,
Numer. Math. Bd. 5 ~ 9 a-
284 Handbook Series Linear Algebra

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_

will remove this danger at the cost of increasing m from 2 to 4").

* Perturbation methods may also help in such cases. But if a computer is at


hand the rearrangement, which is possible for any n, is more straight-forward.
The LR transformation method. RUTISHAUSERand SCHWARZ 285

7. Examples of the use of the procedure


a) If one does not make any use of in/orrn, then one simply declares
procedure in/orm(n, m, s, z, y, eps, a, l, lambda) result: (y, stop);
(the procedure body of in/orm is a dummy statement).
b) What follows is a compound statement/irst (being part of a larger program)
which describes the computation of the five lowest eigenvalues of a bandmatrix A
of order n with elements a [k, ]']. Every one of these eigenvalues is printed im-
mediately after its computation*):

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

10.000 000 012 after 61 LR-steps


c) The matrix
5 2 1 t
6 3 t /
6 3 1 1
6 3 1 t

(12) (symmetric) . . . .
1
t t
3 t 1
6 3 1
6 2
5

with n = 2 9 , m-=3, eps = 1 o - - 1 0 , lower = t r u e . The " e x a c t " eigenvalues of this


matrix are (not ordered)
8.70507 9666810 -- 2
3.40171 3221310-- t
7.36124 386391o--t
t.23895 44781
1.80384 75772
2.38196 6O112
2.92575 84782
3.39419 34240
3.75736 753OO
4.00000 00000
4.12343 19614
4.14589 80337
4.10100 94443
288 Handbook Series Linear Algebra

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

(13) 2, = s~ -- 5 s~ + 8s,; sk = 4 sin2(3 k~ (k = 1 . . . . . 29)

where 3 k~ is taken in hexagesimal degrees. The computation of the first 9 eigen-


values -- those lie well distributes between 0.0870.. and 3 . 7 5 7 . . - - required
47 LR-steps, but for the 7 next eigenvalues, which lie all in the interval 4--<_2_~4.t 46
only t6 steps were needed. Thus the nest of eigenvalues between 4 and 4.146
caused slow concergence not for these eigenvalues themselves but rather for the
previous eigenvalues.
The deviation from the exact values was at most 40 units of the last place for
the t4 smallest eigenvalues and t90 units for the larger ones.
d) The same matrix as in c), but with l o w e r = false. In this case it required
42 LR-steps for t h e 9 largest eigenvalues, 29 LR-steps for 4 further eigenvalues
and then t7 L R steps to obtain the 7 eigenvalues in the interval 4 ~ 2 ~ 4 . t 4 6 ,
the deviations from the exact values at most 170 units in the last place.
e) The eigenvalues of the matrices (8) and (9) have been computed b y procedure
LRCH as well as by the method of JACOBI. We give here the results to illustrate
the influence of the size of the diagonal elements upon the accuracy of the com-
puted eigenvalues:

Matrix (8) by LRCH: Matrix (9) by LRCH: Matrix (8) JAcom:

0.31997 88329 0.32000 02416 0.32000 024t0


0.82107 20356 0.82109 15725 0.82109 15709
(t4) 2.57865 26196 2.57864 26877 2.57864 26823
4.99998 17800 4.99999 93398 4.99999 93311
7.66845 50491 7.66844 12996 7.66844 12844
12.t7889 8967 t2.t7890 766t 12.t7890 7647
t3.4329t 9989 t3.4329t 3808 t3.43291 8787
t.00000 00007~o7 t.00000 0000~o7 t.00000 000001o7
T h e L R t r a n s f o r m a t i o n method. RUTISttAUSER and SCHWARZ 289

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

You might also like