An Algorithm For Generalized Matrix Eigenvalue Problems (1973) (C. B. Moler, G. W. Stewart)
An Algorithm For Generalized Matrix Eigenvalue Problems (1973) (C. B. Moler, G. W. Stewart)
org/terms-priva
AN ALGORITHM 243
C2 C C0 C3 0 0
0 X X X X
0 0 x x x
0 0 0 X X
0 0 0 X X
x x x x x 0 x x x x
x x x x x 0 0 x x x
X X X X X 0 0 0 x x
X X X X X 0 0 0 0 x
x x x x x 0 x x x x
x x x x x 0 0 x x x
x x x x x 0 0 0 x x
0 x x x x 0 0 0 x x
The transformation has introduced a nonzero element on the (5,4)-position of B.
However, a Z ’2(4) can be used to restore the zero without disturbing the zero
introduced in A. The elements of A can be annihilated in the following order"
X X X X X
X X X X X
3
X X X X X
X2 X X X X
4 6
X X X X X
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
AN ALGORITHM 245
- -
(i) choose Qk -k + l(k) to annihilate
(ii) B QkB, .4 QkA.
2. For k-1,2,...,n-2,
(i) forl=n- 1, n- 2,-..,k 4- 1,
(a) choose Qkl 32(/) to annihilate
bk + 1,k, bk + 2,k, "’", b,,k
(b) A 2,A,
- -
(c) choose Zkl 2(/) to annihilate bl + 1,1;
(d) B BZkl A AZkl.
The complete reduction requires about
2
-n 3
multiplications, 3
n
additions
and n square roots. If eigenvectors are also to be computed, the product of the Z’s
must be accumulated. This requires an additional -32n3 multiplications and 3 n
additions. The product of the Q’s is not required for the computation of eigen-
vectors.
3. The explicit QZ step. In this and the next section we assume that A is
upper Hessenberg and B is upper triangular. In this section we shall propose an
iterative technique for reducing A to upper triangular form while maintaining the
triangularity of B. The idea of our approach is to pretend that B is nonsingular and
examine the standard R algorithm for C AB-1. The manipulations are then
interpreted as unitary equivalences on A and B.
Specifically, suppose that one step of the QR algorithm with shift a is applied to
C. Then Q is determined as an orthogonal transformation such that the matrix
(3.1) R Q(C aI)
is upper triangular. The next iterate C’ is defined as
C’= RQ r + aI =- QCQ T
and is known to be upper Hessenberg. If we set
A’ QAZ and B’ QBZ,
where Z is any unitary matrix, then
A’B’- QAZZTB 1QT QAB- 1QT C’..
The matrix Z can be chosen so that B’ is upper triangular. Then, since A’ C’B’
is the product of a Hessenberg and a triangular matrix, it is also upper Hessenberg.
This insures that the nice distribution of zeros, introduced by the algorithm of 2,
is preserved by the QZ step. Thus a tentative form of our algorithm might read:
1. Determine Q so that QC is upper triangular.
- -
2. Determine Z so that QAZ is upper Hessenberg and QBZ is upper triangular.
3. A QAZ, B QBZ.
The problem is then to give algorithms for computing Q and Z which do not
explicitly require C AB-1.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
The determination Q is relatively easy. For from (3.1) and the definition of C
it follows that
(3.2) Q(A aB)= RB =_ S.
Since R and B are upper triangular, so is S. Thus Q is the unitary matrix that
reduces A -aB to upper triangular form. Since A aB is upper Hessenberg, Q
can be expressed in the form
(3.3) Q= Q.-,Q.-2-..Q,, whereQk
To calculate Z we apply Q in its factored form (3.3) to B and determine Z in a
factored form so that B stays upper triangular. Specifically, Q1B has the form
(n 5)
X X X X X
X X X X X
0 0 x x x
0 0 0 x x
0 0 0 0 x
If Q B is postmultiplied by a suitable Z off2(1), the nonzero element below the
diagonal can be removed. Similarly, Q2QBZx has the form
X X X X X
X X X X
X X X X
0 0 0 x x
0 0 0 0 x
and the offending nonzero element can be removed by a Z 2 3/f2(2). Proceeding
in this way, we construct Z in the form
Z ZlZ 2 Z 1, where Zk 3gz(k).
Although QBZ is upper triangular, it is not at all clear that QAZ is upper Hessen-
berg. To see that it is, rewrite (3.2) in the form
(3.4) QAZ SZ + aQBZ.
From the particular form of Z and the fact that S is upper triangular, it follows that
SZ is upper Hessenberg. Thus (3.4)expresses QAZ as the sum of an upper Hessen-
berg and an upper triangular matrix. In fact, (3.4) represents a computationally
convenient form for computing QAZ.
We summarize as follows.
1. Determine Q Q._ 1Qn-2"" Q1 (Qk 3{’2(k)) so that S Q(A- aB) is
upper triangular.
2. Determine Z ZZ2 Z._ (Zke 3g2(k)) so that B’= QBZ is upper
triangular.
3. A’ SZ + aB’.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
AN ALGORITHM 247
is upper triangular. The first part is relatively easy. The first row that would be
obtained from a double shifted QR applied to AB- 1. Since A is upper Hessenberg
and B upper triangular, it is easy to calculate the first two columns of AB-1. But
these, along with the shifts, completely determine the first row of Q. Only non-
singularity of the upper 2 x 2 submatrix of B is actually required here. If either
b or b22 is too small, so that this submatrix is nearly singular, a type of deflation
can be carried out. We shall return to this point later.
The second part is a little more difficult, and is really the crux of the algorithm
since it retains the Hessenberg and triangular forms. Only the first three elements
of the first row of Q are nonzero. Thus, if Q1 is a matrix in W3(1) with the same
first row of Q, then Q IA and Q 1B have the following forms (when n 6):
X X X X X X X X X X X X
2
X X X X X X X X X X X X
X X X X X X X X X X X X
0 0 x x x x 0 0 0 x x x
0 0 0 x x x 0 0 0 0 x x
0 0 0 0 x x 0 0 0 0 0 x
X X X X X X
X X X X X X
X X X X X X
X X X X X X
0 0 0 x x x
0 0 0 0 x x
This is multiplied by Q2 in og3(2) that annihilates the (3, 1)- and (4, 1)-elements.
Then QzQ1AZ1 and QzQBZ have the forms
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
AN ALGORITHM 249
X X X X X X X X X X X X
X X X X X X 0 X X X X X
2
0 x x x x x 0 x x x x x
0 x x x x x 0 x x x x x
0 0 0 x x x 0 0 0 0 x x
0 0 0 0 x x 0 0 0 0 0 x
The first columns are now in the desired form. The nonzero elements outside the
desired structure have been "chased" into the lower 5 5 submatrices.
Now, postmultiply by Z2, a product of a matrix in Yg3(2) and a matrix in
og2(2) that reduces the current B to triangular form. Then premultiply by Q3 in
Yf3 (3) to annihilate two el emen ts outside the Hessen berg structure ofthe resulting A.
The process continues in a similar way, chasing the unwanted nonzero ele-
ments towards the lower, right-hand corners. It ends with a slightly simpler step
which uses Q,_ 2 in Ygz(n 1) to annihilate the (n, n 2)-element of the current A,
thereby producing a Hessenberg matrix, and Z,_ 2 in ff2(n 1) which annihilates
the (n, n 1)-element of the current B, producing a triangular B but not destroying
the Hessenberg A.
The fictitious zeroth column of A is determined in part by the shifts. In analogy
with the implicit double shift algorithm, we take the shifts 0.1 and 0 2 to be the two
zeros of the 2 x 2 problem
det ( 0"B) O,
where
It is not desirable to compute 0"1 and 0"2 explicitly, or even to find the coefficients
in the quadratic polynomial det ( 0.). Instead, following the techniques used
in "hqr2" [8], we obtain ratios of the three nonzero elements of the first column of
(AB- 0.11)(AB- 0.21) directly from formulas which involve only the differ-
ences of diagonal elements. This insures that small, but nonnegligible, off-diagonal
elements are not lost in the shift calculation. The formulas are (m n 1)
atom a 11_ an
bmm -1
a32
a3o
b22.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
AN ALGORITHM 251
5. Further reduction of the quasi-triangular form. The result of" the algorithm
described so far is in an upper triangular matrix B and a quasi-upper triangular
matrix A in which no two consecutive subdiagonal elements are nonzero. This
means that the original problem decomposes into 1 1 and 2 2 subproblems.
The eigenvalues of the I 1 problems are the ratios of the corresponding diagonal
elements of A and B. The eigenvalues of the 2 2 problems might be calculated
as the roots of a quadratic equation, and may be complex even for real ,4 and B.
There are two good reasons for not using the quadratic directly, but instead
reducing the 2 2 problems. First, when A and B are real, the calculation of
eigenvectors is greatly facilitated if all the real eigenvalues are contained in x 1
problems. A more important second reason is that the 1 1 problems contain more
information than the eigenvalues alone. For example, if a and b are small, then
the eigenvalue 2 a /b is ill-conditioned, however reasonable it may appear.
This reason obviously applies to complex eigenvalues as well as real ones. Accord-
ingly, we recommend that the 2 2 problems be reduced to 1 1 problems and
that the diagonal elements, rather than the eigenvalues, be reported.
Without loss of generality we may consider the problem of reducing 2 2
matrices A and B simultaneously to upper triangular form by unitary equivalences.
For our purposes we may assume that B is upper triangular.
Two special cases may be disposed of immediately. If ba is zero, then a
Q e Jcg2(1) may be chosen to reduce azx to zero. The zero elements of QB are not
disturbed. Similarly, if b22 is zero, a Z e 2(1) may be chosen to reduce a2 to zero
without disturbing b 2 .
In the general 2 2 case, it is not difficult to write down formulas for the
elements of A’ QAZ and B’ QBZ for any Q and Z. Moreover, these formulas
can be arranged so that numerically one of a or ba is effectively zero. It is not
obvious, however, that the other element is numerically zero, and the effect of
assuming that it is by setting it to zero could be disastrous. Consequently, we must
consider a somewhat more complicated procedure.
The theoretical procedure for reducing A to triangular form may be described
as follows. Let 2 be an eigenvalue of the problem and form the matrix E A 2B.
Choose a Z 2(1) to annihilate either e or e2. Since the rows of E are parallel,
it follows that whichever of e or e2 is annihilated the other must also be an-
nihilated. Now choose Q Jog2(1) so that either QAZ or QBZ is upper triangular.
Since the first column of QEZ is zero and QEZ QAZ 2QBZ, it follows that,
however Q is chosen, both QAZ and QBZ must be upper triangular.
In the presence of rounding error the method of computing 2 and the choice
of Z and Q are critical to the stability of the process. A rigorous rounding error
analysis will show that, under a reasonable assumption concerning the computed
2, the process described below is stable. However, to avoid excessive detail, we
only outline the analysis. We assume that all computations are done in floating-
point arithmetic with base fl digits and that the problem has been so scaled that
underflows and overflows do not occur. We further assume that a2 is not negligible
in the sense that [a2x[ < fl-tllAll, where II" denotes, say, the row sum norm.
The algorithm for computing 2 amounts to making an appropriate origin
shift and computing an eigenvalue from the characteristic equation. It goes as
follows.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
lu all/b11,
a12 a12 /2b12,
a22 a22 /zb22,
1/22 b12a21
bllb22
(/21(/12
q
bllbz2’
r=pE+q,
(5.1) 2 # + p + sgn (p). x/ (complex if r < 0).
We must now assume that the computed 2 satisfies the equation
det (A’ 2B’) O,
where IIA A’II <_- aallAII and lib B’II <-_ anllBll with rA and an small constants
of order/3-. Define
E’=A’-2B’
and let E denote the computed value
E fl (A 2B).
Then
E’=E+H
with H =< a max {tl A [[, 121 e II} with a of order fl-
We claim that, approximately,
(5.2) IIEII => fl-’ max {llall, 12111nll}.
First we note that
(5.3) [lUll >_-lezl- lazll >=/-llall,
by the assumption that a2 is significant. Now assume that IIEII </-’121 IIBII.
Then subtractive cancellation must occur in the computation of eaa, ea2, and e22.
,
Thus ax 2b1, a2 2b12 and azz 2b22. Hence we have Ilall => 12111nll,
and, from (5.3), IIEII _->/-’121 IIBll, a contradiction.
Now
0 det (E’)= det (E) + (el + hx)h22 (e12 + h2)h21 + hlxe22 h2e21.
Hence
Idet (E)[ =< plllEll max {llall, 12111nll} / p2[max {llhll, 12111nll}] 2,
where pa and P2 are of order fl-t. From (5.2) it then follows that
Idet (E)l =< PlIEII max
where p is of order fl-t.
Now consider the determination of Z. Assume that the second row of E is
larger than the first. Then Z e /g2(1) is chosen to annihilate e2a. Let F EZ.
Then f2 is essentially zero. Furthermore, since Z is unitary,
Ifxxf221 Idet (E)l _-< pllEII max {llZll, I111nll}.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
ALGORITHM 253
But If221 Ile2]l and, since e2 was assumed to be the,larger row, lie211 IIEII.
Hence we have approximately
Ifxl _-< max (llhll, 12111nll).
To choose Q, let
C AZ, D BZ,
and let fl, Cl, and d be the first columns of F, C, and D. Let q2 denote the second
row of Q. If IIZ >= 121 Ilnll, we choose Q to annihilate d21. Numerically this means
that
Iqdxl <= rllnll,
where tr is a constant of the order of fl-t. We must show that qc is negligible. But
Iqcll Iqf + 2qdll
_-< fl + I,l qd 111
__< p max { a II, I,1 nil / al,l n
-<_ (p /
If, on the other hand, 121 Ilnll > Ilall, we choose Q so that
Iqcl <= rllall.
It then follows that
Iqdl Iqf qr2cl/121
=< plA1-1 max { Z II, I,1 n II} / rl,l- 11A
-< (p a)llnll.
/
is justified by their condition. If an eigenvalue and eigenvector are not too "ill-
disposed," then they produce a small relative residual.
Similar numerical properties cannot generally be expected from any algorithm
which inverts B or any submatrix of B. This is even true of 2 2 submatrices, as
illustrated by the following example due to Wilkinson:
3 .4’ 0
Here p is about the square root of the machine precision, that is, # is not negligible
compared to 1, but/2 is. There is one eigenvalue near -2. Small relative changes
in the elements of the matrices cause only small relative changes in this eigenvalue.
The other eigenvalue becomes infinite as # approaches zero. Great care must be
taken in solving this problem so that the mild instability of the one eigenvalue
does not cause an inaccurate result for the other, stable eigenvalue.
Of course, the use of unitary transformations makes our technique somewhat
slower than others which might be considered. But the added cost is not very
great. In testing our program, we solve problems of order 50 regularly. A few
problems of orders greater than 100 have been run, but these become somewhat
expensive when they are merely tests.
One typical example of order 50 requires 45 seconds on Stanford’s IBM 360
model 67. Of this, 13 seconds are spent in the initial reduction, 29 seconds are used
for the 61 double iterations required, and 3 seconds are needed for the diagonal
elements and eigenvectors. If the eigenvectors are not needed and so the trans-
formations not saved, the total time is reduced to 27 seconds. By way of comparison,
formation of B- 1A h la Peters and Wilkinson [9] and use of FORTRAN versions 12]
of "orthes" [5] and "hqr2" [8] requires a total of 27 seconds for this example. (All
of these times are for code generated by the IBM FORTRAN IV compiler, H level,
with the optimization parameter set to 2.)
In the examples we have seen so far, the total number of double iterations
required is usually about 1.2 or 1.3 times the order of the matrices. This figure is
fairly constant, although it is not difficult to find examples which require many
fewer or many more iterations. As a rule of thumb, for a matrix of order n the time
required on the model 67 is about .36 n 3 milliseconds if vectors are computed,
.22 n 3 milliseconds if they are not.
The example in Table 1 is not typical, but it does illustrate several interesting
points. It was generated by applying nonorthogonal rank one modifications of the
identity to direct sums of companion matrices. The companion matrices were
chosen so that the resulting problem has three double roots,
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
AN ALGORITHM 255
TABLE
50 -60 50 -27 6 6 16 5 5 5 -6 5
38 -28 27 -17 5 5 5 16 5 5 -6 5
27 -17 27 -17 5 5 5 5 16 5 -6 5
h
27 -28 38 -17 5 5 5 5 5 16 -6 5
27 -28 27 -17 16 5 5 5 5 5 -6 16
27 -28 27 -17 5 16 6 6 6 6 -5 6
25.768670843143 .2637605112.10 -6
12.821841071323 .1312405807.10 -6
5.814535434181 + 0.071071345641i 11.629071028730
5.800765071150 10.047220375909i 11.601530302268
5.736511506410 + 9.935928843473i 11.473022854605
5.510879468089 9.545122710676i 11.021758784186
/#
0.976972281.108
-0.976972290.108
0.49999999310489 + 0.86602543924271i
0.49999999310489 0.86602543924271i
0.50000000689511 + 0.86602536832617i
0.50000000689511 0.86602536832617i
The double root at results from the fact that B has a double zero eigenvalue.
All three roots are associated with quadratic elementary divisors; i.e., each root
has only one corresponding eigenvector. The computed diagonals of the triangu-
larized matrices are given in the table. Note that the four finite eigenvalues are
obtained with a relative accuracy of about 10-8. This is about the square root of
the machine precision and is the expected behavior for eigenvalues with quadratic
elementary divisors. The singularity of B does not cause any further deterioration
in their accuracy. Furthermore, the infinite eigenvalues are obtained from the
reciprocals of quantities which are roughly the square root of the machine precision
times the norm of B. Consequently we are somewhat justified if we claim, to have
computed the square root of infinity.
Acknowledgments. W. Kahan and J. H. Wilkinson made several helpful
comments. Linda Kaufman of Stanford has recently shown how to carry out the
corresponding generalization of the LR algorithm and has written a program that
accepts general complex matrices. Charles Van Loan of the University of Michigan
has done a detailed roundoff error analysis of the process described in section 5.
1This prompts us to recall the limerick which introduces George Gamow’s One, Two, Three,
Infinity:
There was a young fellow from Trinity
Who tried x//-
But the number of digits
Gave him such fidgets
That he gave up Math for Divinity.
ownloaded 12/29/22 to 129.222.219.0 by Cleve Moler ([email protected]). Redistribution subject to SIAM license or copyright; see https://epubs.siam.org/terms-priva
REFERENCES
[1] CHARLES CRAWFORD, The numerical solution of the generalized eigenvalue problem, Doctoral
thesis, University of Michigan, Ann Arbor, 1970; Comm. ACM., 16 (1973), pp. 41-44.
[2] G. Fix AND R. HEmERGER, An algorithm for the ill-conditioned generalized eigenvalue problem,
Numer. Math., this Journal, 9 (1972), pp. 78-88.
[3] J. G. F. FRANCXS, The QR transformation--a unitary analogue to the LR transformation, Comput.
J., 4 (1961-62), pp. 265-271,332-345.
[4] A. S. HOUSEHOLDER, Unitary triangularization of a nonsymmetric matrix, J. Assoc. Comput.
Mach., 5 (1958), pp. 339-342.
[5] R. S. MARTIN AND J. H. WILKINSON, Similarity reduction of a general matrix to Hessenberg form,
Numer. Math., 12 (1968), pp. 349-368.
[6] ., Reduction of the symmetric eigenproblem Ax 2Bx and related problems to standard
form, Ibid., 11 (1968), pp. 99-110.
[7] C. B. MOLER AND G. W. STEWART, The QZ algorithm for Ax 2Bx, this Journal, 9 (1972), pp.
669-686.
[8] G. PETERS AND J. H. WILKINSON, Eigenvectors of real and complex matrices by LR and QR tri-
angularizations, Numer. Math., 16 (1970), pp. 181-204.
[9] ., Ax 2Bx and the generalized eigenproblem, this Journal, 7 (1970), pp. 479-492.
[10] G.W. STEWART, On the sensitivity of the eigenvalue problem Ax 2Bx, submitted for publication.
[11] J. n. WILKINSON, The Algebraic Eigenvalue Problem, Oxford University Press, Oxford, 1965.
[12] FORTRAN translations of the ALGOL procedures in [5] and [8] may be obtained from the NATS
Project, Applied Mathematics Division, Argonne National Laboratories, Argonne, Illinois.
13] A. M. DELL, R. L. WEIL AND G. L. THOMPSON, Roots of Matrix Pencils, Comm. ACM., 14 (1971),
pp. ll3-117.