24.02.2013 Views

Householder's method for symmetric matrices

Householder's method for symmetric matrices

Householder's method for symmetric matrices

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Numerische Mathematik 4, 354-- 361 (1962)<br />

Handbook Series Linear Algebra*<br />

<strong>Householder's</strong> <strong>method</strong> <strong>for</strong> <strong>symmetric</strong> <strong>matrices</strong><br />

Contributed by<br />

J. H. WILKINSON<br />

1. Theoretical background<br />

1.1. The reduction to tridiagonal /orm<br />

1.1.1. The <strong>symmetric</strong> matrix A 1 is reduced to the <strong>symmetric</strong> tridiagonal<br />

matrix A~_ 1 by (n -- 2) orthogonal similarity trans<strong>for</strong>mations. We define <strong>matrices</strong><br />

A i by the relations<br />

Ai+l=PiAiPi (i = t, 2 ..... n -- 2) (1)<br />

where the P~ are orthogonal <strong>matrices</strong> defined by<br />

-Pi = I -- 2 w i w T (2)<br />

w~= Ewi,1; wi,~; ... wi,~-i; 0; 0;... ;oj (3)<br />

~:'~=I. (4)<br />

We assume that A i is of tridiagonal <strong>for</strong>m in its last (i- t) rows and columns<br />

and choose the elements of wi so that Ai+ 1 is of tridiagonal <strong>for</strong>m in its last i<br />

rows and columns. It is evident from the assumed <strong>for</strong>m of A i and of w i that<br />

the trans<strong>for</strong>mation with matrix Pi leaves the last (i- t) rows and columns un-<br />

altered, and hence the w i have only to be chosen so that the (1, 1), (l, 2) .....<br />

(l, 1 -- 2) elements of Ai+ 1 are zero (l=n -- i + 1). Clearly all the A i are <strong>symmetric</strong>.<br />

There are two essentially different determinations of the vector w i I1~, [21<br />

and [31, and these we now describe. In defining the i-th trans<strong>for</strong>mation we<br />

denote the (j, k) element of A i by aik, omitting <strong>for</strong> convenience reference to<br />

the suffix i. Defining ai and H i by the relations<br />

the two determinations of wi are given by<br />

ai=a~.l+a , 2 l,z+.,.+au_1 (S)<br />

Hi =ai :E al, l-1 a} (6)<br />

Wi, l_l= Eal, l_t ~ai]/(2Hi) 89 (7)<br />

wi, j=au/(2H3~ i =t, 2 ..... l --2. (8)<br />

* Editors note. In this fascicle, prepublication of algorithms from the Linear<br />

Algebra series of the Handbook <strong>for</strong> Automatic Computation is started. Algorithms<br />

are published in ALGOL 60 reference language as approved recently by IFIP.<br />

[BACKUS, J. W., BAUER F. L. et al. : Report on the algorithmic language ALGOL 60.<br />

Numer. Math. 2, 106-- t 36 (1960)]. Contributions in this series should be styled after<br />

the most recently published ones. Inquiries are to be directed to the editor.<br />

F. L. BAUER, Mainz.


If we write<br />

then<br />

J. H. ~u : <strong>Householder's</strong> <strong>method</strong> ~or <strong>symmetric</strong> <strong>matrices</strong> 3 5 5<br />

u~= [al,1; al,~; ...; al,,-2; ai, l-1 0;...; O] (9)<br />

I- 2w, w~ = I ~' ~ (to)<br />

Hi<br />

1.1.2. In the above <strong>for</strong>mulation it is assumed that we take either the upper<br />

signs or the lower signs throughout. In practice the choice must be made so<br />

as to give numerical stability and this is achieved by taking the plus sign in<br />

equation (6) if at, l_l>=O and the minus sign otherwise.<br />

It is important to take advantage of the symmetry of both Ai+ ~ and A~<br />

when evaluating Ai+ 1 from equation (1), and to this end we compute only the<br />

elements of Ai+ 1 on and below the diagonal. A convenient way of organising<br />

the computation is as follows. We write<br />

~ A~ u~+ (11)<br />

----- A ~ -- u i H~ H~ H~<br />

This may be simplified by introducing vectors p~ and qi and a scalar K i defined by<br />

then we have<br />

p~ =A~ udH~ (t2)<br />

Ki=u~pd(2H3 (t3)<br />

qi=P~-- Ki u~ (t4)<br />

Equation (t5) is used only to compute the elements of rows (/) to (l--t) of<br />

A~+~ on and below the diagonal. The elements of rows (l+t) to (n) are the<br />

same as in A i; in row l the (1, l) element is the same as in A i while the (l, l -- t)<br />

element becomes T a~.<br />

From the <strong>for</strong>m of A~ and u i it is evident that Pi is of the <strong>for</strong>m<br />

so that q~ is given by<br />

PT=- EP~,~; P~,~; ..." P~,~-~; P~,~; 0; ...; o~<br />

q~-~ [Pi, x --Kiui,1; Pi,2 --Kiui,2; ... ; Pi, l-x- Kiui, l-1; P~,z; 0; ... ; 0~.<br />

If a~ is zero then we may take P~=I and no trans<strong>for</strong>mation is needed. This<br />

case is given special treatment. We could in fact take P~= I if<br />

a~,x + at,~ + ... +a~,~_~=0<br />

since the l-th row and column are then already in tridiagonal <strong>for</strong>m, but this<br />

has not been done. Note that in this case the trans<strong>for</strong>mation with matrix P~<br />

merely changes the sign of the (l, l -- ~) element.


356 Handbook Series Linear Algebra<br />

1.2. Backtrans/ormation<br />

If z~_ 1 is an eigenvector of the tridiagonal matrix An_ 1 derived by the<br />

Householder process, then the corresponding eigenvector of A 1 is P~ P2 -.. P,-2z~-1 -<br />

so that<br />

We write<br />

Pk Pk+l ... Pn-2Zn-l=Zk (1)<br />

Pkzk+l = zk. (2)<br />

From equations (6), (9) and (t0) of the Householder <strong>method</strong> we have<br />

u k u T<br />

Zk=Zk+~ Hk zk+l. (3)<br />

The non-zero element of u k are stored in the /-th row of the lower triangle of<br />

the array A, (l----n--k+ Q, and H~ may be computed from the relation<br />

-- H k -=:q: a~ [at, z_ 1 -r (4)<br />

The first factor on the right of equation (4) is stored in bk and the second as<br />

the (1, l--t) element of A. The right-hand side of (3) is computed in the steps<br />

U T gk+ 1<br />

S -- Hk , (5)<br />

zk =zk+l + Suk. (6)<br />

Each of the z k is overwritten in the store occupied by the original z~_ 1 from<br />

which it was produced so that no extra storage is required in the back-trans-<br />

<strong>for</strong>mation.<br />

2. Applicability<br />

The algorithm householder tridiagonalization works <strong>for</strong> arbitrary <strong>symmetric</strong><br />

<strong>matrices</strong>, possibly with multiple eigenvalues. In the latter case, the resulting<br />

tridiagonal matrix would decompose if the computation were exact. In practice<br />

we will expect that it will "almost decompose".<br />

The algorithm backtrans/ormation derives the eigenvector system of A from<br />

an eigenvector system of the tridiagonal matrix.<br />

3. Formal parameter list<br />

The <strong>symmetric</strong> matrix A of order n is given as a lower triangular matrix.<br />

It is reduced to a <strong>symmetric</strong> tridiagonal matrix, the diagonal elements of which<br />

are stored as a vector c and the subdiagonal elements as a vector b (with an<br />

additional last component b~= 0). The lower triangle of A together with b are<br />

used to store sufficient in<strong>for</strong>mation <strong>for</strong> the details of the trans<strong>for</strong>mation to be<br />

recoverable in the procedure backtrans<strong>for</strong>mation.<br />

Backtrans<strong>for</strong>mation: The input matrix z contains the ml eigenvectors of<br />

the tridiagonal matrix which were computed by the procedure tridiinverse<br />

iteration, (zii is the /-th component of the eigenvector corresponding to wj).<br />

At the end of the procedure z is the matrix of the corresponding eigenvectors<br />

of the initial matrix A.


j. ]7I. \VILKINSON : <strong>Householder's</strong> <strong>method</strong> <strong>for</strong> <strong>symmetric</strong> <strong>matrices</strong> 357<br />

4. Algol programs<br />

procedure householder tridiagonalisation (a, n) result: (c, b, a);<br />

value n;<br />

integer n;<br />

array a, b,<br />

comment<br />

c;<br />

The <strong>symmetric</strong> matrix a of order n is given as a lower triangular<br />

matrix. It is reduced to a <strong>symmetric</strong> tridiagonal matrix, the diagonal<br />

elements of which are stored as the vector c and the sub-diagonal<br />

elements as the vector b (with an additional last component b In I = 0).<br />

The lower triangle of a together with b are used to store sufficient<br />

in<strong>for</strong>mation <strong>for</strong> the details of the trans<strong>for</strong>mation to be recoverable<br />

in the procedure backtrans/ormation;<br />

begin<br />

integer i, i, k;<br />

real ai, sigma, h, b?', bigk, bi ;<br />

array q El : n -- t ~ ;<br />

<strong>for</strong> i ,=n step -- t until 3 do<br />

begin sigma :=0;<br />

<strong>for</strong> k,=l step t until i--t do<br />

sigma :=sigma + a Ei, k I a[i, k~ ;<br />

ai:=a[i,i-- ~;<br />

if ai >-- 0 then bi =-- sqrt (sigma)<br />

else bi := sqrt (sigma);<br />

if bi ~ 0 then<br />

begin<br />

h :=sigma -- ai bi;<br />

a[i, i--1~ =ai--bi;<br />

<strong>for</strong>j =i--1 step --1 until 1 do<br />

begin bi :=0;<br />

<strong>for</strong> k ,=i -- t step -- 1<br />

until j do<br />

bi ,= bi + a [k, i~ a [i,k ~ ;<br />

<strong>for</strong> k =i -- l step -- l<br />

until t do<br />

bi ,=hi+ all", k~ k];<br />

q [i~ '=bi/h<br />

end?';<br />

bigk ,= 0;<br />

Numer. Math. Bd. 4<br />

comment<br />

comment<br />

Selection of stable sign;<br />

Special case sigma = 0:<br />

trans<strong>for</strong>mation skipped;<br />

comment Here normalised addition<br />

must be used otherwise<br />

orthogonality of the trans-<br />

<strong>for</strong>mation most likely will<br />

be lost in the case of can-<br />

cellation;<br />

comment Computation of A<br />

comment Computation of p;<br />

25


358 Handbook Series Linear Algebra<br />

<strong>for</strong>i :=i-- 1 step -- 1 until 1 do<br />

bigk ,=bigk + a [i, ]] x q [1'] ;<br />

bigk ,=bigk/(2 x h) ;<br />

comment Computation of K;<br />

<strong>for</strong> i ,=i -- 1 step -- 1 until I do<br />

q [/'] ,=q [/'] -- bigk X a [i,/'~ ;<br />

<strong>for</strong>/' ,=i -- 1 step -- t until t do<br />

begin<br />

<strong>for</strong> k :=j step -- t until t do<br />

comment Computation of q;<br />

,~[i, k] ,=a[i, k~-,~[i,i] x q [k~-a [i, k] x~,[i];<br />

comment Computation of the (i + 1)th<br />

matrix A ;<br />

endj<br />

end<br />

end i;<br />

<strong>for</strong>i :--n step -- t until t do<br />

c [i] :=a[i, i];<br />

bell ,----a[2, 1] ;<br />

b In] ".--0<br />

end ;<br />

procedure backtrans/ormation (a, b, z, n, ml) result: (z);<br />

value n, ml ;<br />

integer n, ml;<br />

array a, b, z;<br />

comment b is the subdiagonal of the <strong>symmetric</strong> tridiagonal matrix of order n.<br />

z is the matrix <strong>for</strong>med by ml eigenvectors of the tridiagonal matrix.<br />

The corresponding matrix of eigenvectors of the original matrix is<br />

computed by a backtrans<strong>for</strong>mation and overwritten on z. The details<br />

of the trans<strong>for</strong>mation are stored in the lower triangle of a and in b;<br />

begin<br />

integer i, i, k;<br />

real s;<br />

<strong>for</strong>/' ,=1 step t until m] do<br />

<strong>for</strong>k =3 step I until n do<br />

ifb [k -- 1] ~0 then<br />

begin s :=0;<br />

<strong>for</strong>i :=1 step I until k -- 1 do<br />

s ,=s+a[k,i] iJ;<br />

s =s/(b [k - t~ x ~[k, k - 1]);<br />

<strong>for</strong>i ,=t step t until k--t do<br />

zEi, il ,=~ [i,i] +s x,~ [k, i]<br />

end<br />

end;<br />

5. Organizational and notational details<br />

5.1. Householder tridiagonalisation<br />

In the ALGOL procedure it is assumed that A z is given originally as the<br />

lower triangle of an n array. The reduction to tridiagonal <strong>for</strong>m is made


J. H. WILKINSON: <strong>Householder's</strong> <strong>method</strong> <strong>for</strong> <strong>symmetric</strong> <strong>matrices</strong> 359<br />

working with this lower triangle of elements, the details of the trans<strong>for</strong>mation<br />

being overwritten on the same triangle. From equations (6) and (10) it is clear<br />

that we will retain full in<strong>for</strong>mation on each trans<strong>for</strong>mation if we store the com-<br />

ponents of the u i and :J: a, ~. Each non-zero element of each u i is overwritten<br />

on the ali element from which it is derived. This is particularly convenient<br />

because apart from the elements ui, l_ 1 each uii is equal to the corresponding<br />

current a~i.<br />

The storage of the elements of each u i leaves no space available <strong>for</strong> the<br />

(1, l--t) element of each Ai+ 1. These elements are, of course, the off-diagonal<br />

elements of the final tridiagonal matrix. They are accordingly stored in the<br />

linear array b of order n. An array q is also used to store the components of<br />

the successive Pi and qi- The vector qi is overwritten on Pi-<br />

The off-diagonal elements of A~_I are obtained finally as the linear array b.<br />

A copy of the diagonal elements of A~_ 1 is made to give the linear array c. This<br />

is convenient since tridiagonal <strong>matrices</strong> often arise as primary data and it is<br />

obviously desirable to present such <strong>matrices</strong> as linear arrays rather than as a<br />

square array.<br />

5.2. Backtrans/ormation<br />

The matrix z containing the eigenvectors of the tridiagonal matrix is over-<br />

written by the corresponding matrix of the eigenvectors of the original matrix.<br />

The matrix A is equal to the matrix resulting from a Householder tridiagonali-<br />

sation, but the process uses only its lower triangle.<br />

6. Discussion of numerical properties<br />

In determining the (1 -- t) element of the vector w i it is important to get exact<br />

orthogonality of the trans<strong>for</strong>mation even when cancellation occurs, there<strong>for</strong>e<br />

normalized addition must be used there.<br />

7. Examples of the use of the procedure<br />

householder tridiagonalisation may be the first step in the determination<br />

of the eigenvalues and eigenvectors of the matrix A followed by a determination<br />

of the eigenvalues by the procedure tridibisection and possibly by a determination<br />

of the eigenvectors of the resulting tridiagonal matrix by the procedure tridi-<br />

inverse iteration. In the last case the procedure backtrans/ormation is to be<br />

applied.<br />

householder tridiagonalisation may also be the preparation <strong>for</strong> the appli-<br />

cation of the QD or QR algorithm.<br />

8. Test results<br />

The procedures were tested on the Z 22 and Siemens 2002 in the Institute<br />

<strong>for</strong> Applied Mathematics at Mainz University and a second test was per<strong>for</strong>med<br />

in the Institute <strong>for</strong> Applied Mathematics of the EidgenSssische Technische<br />

Hochschule at Zfirich.<br />

We give two examples, the second being of a matrix <strong>for</strong> which the correspond-<br />

ing tridiagonal matrix decomposes into the direct sum of two smaller tridiagonal<br />

25*


360 Handbook Series Linear Algebra<br />

<strong>matrices</strong>. The results of the tridiagonalisation on Siemens 2002 are displayed.<br />

For the second example, the tridiagonal matrix obtained on a computer with<br />

a different word-length (or even with the same word-length but with a different<br />

rounding procedure) may differ completely in its upper segment. The eigen-<br />

values should be unaffected.<br />

The eigenvectors of the two tridiagonal <strong>matrices</strong> were computed by tridibi-<br />

section (see article "Calculation of the eigenvectors of a <strong>symmetric</strong> tridiagonal<br />

matrix by inverse iteration", section 8). We give these vectors and the eigen-<br />

vectors of the original matrix A; the latter were computed by the procedure<br />

backtrans/ormation.<br />

Lower triangle of Lower triangle of<br />

matrix A matrix B<br />

5; 1;<br />

4; 6; 2; 4;<br />

3; O; 7; 3; 5; 6;<br />

2; 4; 6; 8; O; --t; --2; 1;<br />

t; 3; 5; 7; 9; 1; o; --3; 2; 4;<br />

2; 3; O; 3; 5; 6;<br />

Matrix A<br />

b[i] c[i]<br />

--3.290140684 1.380806052<br />

1.901233318 4.029608282<br />

3.485636221 5.161014238<br />

--9.165151390 1.5428571441o I<br />

0 9.000000000<br />

Eigenvectors of the matrix A<br />

--2.4587793861o--t<br />

--3.0239603961o--I<br />

--4.532t452331o--1<br />

--0.577177153<br />

-- 5.56384583 71o-- 1<br />

-- 5.5096195601o-- 1<br />

--0.709440339<br />

3.40t 79t3251o--t<br />

8.34t095344~o--2<br />

2.6543567721o-- 1<br />

Matrix B<br />

b[q c[q<br />

--0.965478361 --0.442587832<br />

1.894086692 --0.693465710<br />

--1.1663618651o--8 1.2136053561oi<br />

--1.000000002 0.000000000<br />

--6.855654601 5.000000000<br />

0 6.000000000<br />

Eigenvectors of the matrix B<br />

--2.21789750510-- I<br />

--4.729t t32991o-- l<br />

--0.720938140<br />

2.5941489041 o- 1<br />

3.5780708731o--t<br />

1.0995626711o-- 1<br />

t .70061797910-- 1<br />

t.7858463011o-- 1<br />

--t .3806649231o--t<br />

2.9591512961o--1<br />

0.565489671<br />

7.1608646531o-- t


J. H. WILKINSON: <strong>Householder's</strong> <strong>method</strong> <strong>for</strong> <strong>symmetric</strong> <strong>matrices</strong> 36t<br />

Eigenvectors of the matrix A<br />

-- 5.47t 727952ao-- f<br />

3.12569920610-- t<br />

--0.618112077<br />

1 A 560659371o--t<br />

4.5549374641o-- 1<br />

3.4to1304181o--I<br />

- - t. 1643462OOlo-- t<br />

--o.1959o67121o--1<br />

--o.682o43o35<br />

6.36o71214Olo -- t<br />

4.6935807241o-- t<br />

--0.542212195<br />

- - 5.4445240331o-- t<br />

4.2586566t91o--1<br />

8.8988503651o--2<br />

R e f e r e n c e s<br />

Eigenvectors of the matrix B<br />

6.6954556761o--t<br />

--3.9533t735010--t<br />

1.36726362t io-- 1<br />

--0.288372768<br />

4.63372192810 -- t<br />

- - 2.808 t 098561o-- 1<br />

0.t3164t89tlo--t<br />

2.5928612341o-- 1<br />

--1.995t 543031o--t<br />

--0.728887389<br />

5.5tt 5485651o--t<br />

--2.40296694tlo--t<br />

5.0395 t 79731o- 1<br />

o. 740322901 lo-- t<br />

- - 5.2916056301o-- t<br />

--3.t320230781o--t<br />

-- 5.2138969241o-- t<br />

3.0o99502941o--t<br />

3.9101568851o--1<br />

--0.8087821031o--t<br />

--4.t 868566571o-- t<br />

- - 4.4628447191o--<br />

--0.520371701<br />

4.4t 94029251o-- t<br />

I1] BAUER, F. L., and HOUSEHOLDER, A. S. : On certain <strong>method</strong>s <strong>for</strong> expanding the<br />

characteristic polynomial. Numer, Math. 1, 29-- 37 (t 959).<br />

[2] BAUER, F. L.: Sequential reduction to tri-diagonal <strong>for</strong>m. J. Soc. Indust. Appl.<br />

Math, 7, 107--113 (t959).<br />

[3] WILKINSON, J. H. : <strong>Householder's</strong> <strong>method</strong> <strong>for</strong> the solution of the algebraic eigen-<br />

problem. Computer J. 3, 23 (1960).<br />

National Physical Laboratory<br />

Teddington, Middlesex

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!