lecture-08
lecture-08
Exercise 5.4.55 Use MATLAB's help facility to find out about the commands schur
and rsf2csf . Use them to find the forms of Schur (Theorem 5.4.11) and Winter-
Murnaghan (Theorem 5.4.22) for the matrix
The results of the previous section encourage us to seek algorithms that reduce a
matrix to triangular form by similarity transformations, as a means of finding the
eigenvalues of the matrix. On theoretical grounds we know that there is no algorithm
that accomplishes this task in a finite number of steps; such an algorithm would
violate Abel's classical theorem, cited in Section 5.2. It turns out, however, that
there are finite algorithms, that is, direct methods, that bring a matrix very close to
upper-triangular form.
Recall that an n x n matrix A is called upper Hessenberg if a^ = 0 whenever
i > j + I. Thus an upper Hessenberg matrix has the form
In this section we will develop an algorithm that uses unitary similarity trans-
formations to transform a matrix to upper Hessenberg form in ^-n3 flops. This
algorithm does not of itself solve the eigenvalue problem, but it is extremely impor-
tant nevertheless because it reduces the problem to a form that can be manipulated
inexpensively. For example, you showed in Exercise 5.3.33 that both the LU and
QR decompositions of an upper Hessenberg matrix can be computed in O(n 2 ) flops.
Thus Rayleigh quotient iteration can be performed at a cost of only 0(n 2 ) flops per
iteration.
The reduction to Hessenberg form is especially helpful when the matrix is Her-
mitian. Since unitary similarity transformations preserve the Hermitian property, the
reduced matrix is not merely Hessenberg, it is tridiagonal. That is, it has the form
350 EIGENVALUES AND EIGENVECTORS I
(b) Show that the cost of a QR decomposition of A is O(ri) flops, provided the
matrix Q is not assembled explicitly.
Let
which has the desired zeros in the first column. This operation is just like the first
step of the QR decomposition algorithm, except that it is less ambitious. Instead of
transforming all but one entry to zero in the first column, it leaves two entries nonzero.
The reason for the diminished ambitiousness is that now we must complete a similarity
transformation by multiplying on the right by . Letting and
REDUCTION TO HESSENBERG AND TRIDIAGONAL FORMS 351
Because of the form of Qi, this operation does not destroy the zeros in the first
column. If we had been more ambitious, we would have failed at this point.
The second step creates zeros in the second column of A\, that is, in the first
column of Â\. Thus we pick a reflector Qi G C^ n ~ 2 ^ x ( n ~ 2 ) in just the same way as
the first step, except that A is replaced by A\. Let
Then
The third step creates zeros in the third column, and so on. After n — 2 steps
the reduction is complete. The result is an upper Hessenberg matrix that is unitarily
similar to A: B = Q*AQ, where
If A is real, then all operations are real, Q is real and orthogonal, and B is orthogonally
similar to A.
352 EIGENVALUES AND EIGENVECTORS I
Exercise 5.5.3 Count the flops in (5.5.2). Show that the left multiplication part costs about
|n3 flops, the right multiplication part costs about 2n3 flops, and the rest of the cost
of the reflector setups is O(n 2 ). Thus the total cost is about flops. Why do the
right multiplications require more flops than the left multiplications do? D
We save a little bit here by not performing the computation bTQi, which duplicates
the computation Qib.
354 EIGENVALUES AND EIGENVECTORS I
The bulk of the effort in this step is expended in the computation of the symmetric
submatrix . We must do this efficiently if we are to realize significant
2
savings. If symmetry is not exploited, it costs about 4n flops to calculate and
2
another 4n flops to calculate , as you can easily verify. Thus the entire
computation of A\ costs about 8n2 flops. It turns out that we can cut this figure in
half by carefully exploiting symmetry.
Qi is a reflector given in the form Thus
The final manipulation is to split the last term into two pieces in order to combine
one piece with the term VUT and the other with uvT. In other words, let w = v + an.
Then
which costs four flops per updated array entry. By symmetry we need only update
the main diagonal and lower triangle. Thus the total number of flops in this segment
i s 4 ( n — l)n/2 « 2n 2 . This does not include the cost of calculating w. First of all,
the computation v = —„Au costs about 2n2 flops. The computation a = — ^UTV
costs about In flops, as does the computation w = v + cm. Thus the total flop count
for the first step is about 4n2, as claimed.
The second step of the reduction is identical to the first step, except that it acts on
the submatrix AI . In particular, (unlike the nonsymmetric reduction) it has no effect
on the first row of AI . Thus the flop count for the second step is about 4(n — I)2 flops.
After n — 2 steps the reduction is complete. The total flop count is approximately
4(n2 + (n - I)2 + (n - 2)2 + •••)« f n3.
REDUCTION TO HESSENBERG AND TRIDIAGONAL FORMS 355
This algorithm accesses only the main diagonal and lower triangle of A. It stores
the main-diagonal entries of the tridiagonal matrix B in a one-dimensional array d
(di = ba, i — 1,... ,n) and the off-diagonal entries in a one-dimensional array s
(Si = &i+i,i = &i,i+i, i = 1,. • • ,n — 1). The information about the reflectors used
in the similarity transformation is stored exactly as in (5.5.2).
Additional Exercises
Exercise 5.5.7 MATLAB's hess command transforms a matrix to upper Hessenberg form.
To get just the upper Hessenberg matrix, type B = hess (A) . To get both the
Hessenberg matrix and the transforming matrix (fully assembled), type [Q, B] =
hess(A).
(a) Using MATLAB, generate a random 100 x 100 (or larger) matrix and reduce
it to upper Hessenberg form:
n = 100
A = r a n d n ( n ) ; % or A = randn(n) + i * r a n d n ( n ) ;
[Q,B] = hess(A);
q = randn(n,l) + i*randn(n,1);
q = q/norm(q);
rayquo = q'*B*q;
qq = (B - rayquo*eye(n))\q;
(c) Give evidence that your Rayleigh quotient iteration converged quadratically.
(d) Check that you really do have an eigenpair of A by computing the residual
norm \\Av — Xv\\2.
D
Exercise 5.5.8 The first step of the reduction to upper Hessenberg form introduces the needed
zeros into the vector b, where
r T
We used a reflector to do the task, but there are other types of transformations
that we could equally well have used. Sketch an algorithm that uses Gaussian
elimination with partial pivoting to introduce the zeros at each step. Don't forget that
each transformation has to be a similarity transformation. Thus we get a similarity
transformation to Hessenberg form that is, however, nonunitary. This is a good
algorithm that has gone out of favor. The old library EISPACK includes it, but it has
been left out of LAPACK. D
For many years now the most widely used algorithm for calculating the complete set of
eigenvalues of a matrix has been the QR algorithm of Francis [25] and Kublanovskaya
[45]. The present section is devoted to a description of the algorithm, and in the
section that follows we will show how to implement the algorithm effectively. The
explanation of why the algorithm works is largely postponed to Section 6.2. You can
read Sections 6.1 and 6.2 right now if you prefer.
Consider a matrix A G C n x n whose eigenvalues we would like to compute. For
now let us assume that A is nonsingular, a restriction that we will remove later. The
basic QR algorithm is very easy to describe. It starts with AQ — A and generates a
sequence of matrices ( Aj ) by the following prescription:
That is, Am-i is decomposed into factors Qm and Rm such that Qm is unitary and
Rm is upper triangular with positive entries on the main diagonal. These factors are
uniquely determined (Theorem 3.2.46). The factors are then multiplied back together
THE QR ALGORITHM 357
in the reverse order to produce Am. You can easily verify that Am = Q*mAm-\Qm.
Thus Am is unitarily similar to Am-\.
Exercise 5.6.2
(a) Show that Am = Q^Am^Qm.
(b) Show that Am - RmAm-iR^.
Notice that part (a) is valid, regardless of whether or not A is singular. In contrast,
part (b) is valid if and only if A is nonsingular. (Why?) D
Since all matrices in the sequence (Aj) are similar, they all have the same eigenval-
ues. In Section 6.2 we will see that the QR algorithm is just a clever implementation
of a procedure known as simultaneous iteration, which is itself a natural, easily
understood extension of the power method. As a consequence, the sequence (Aj)
converges, under suitable conditions, to upper-triangular form
where the eigenvalues appear in order of decreasing magnitude on the main diagonal.
(As we shall see, this is a gross oversimplification of what usually happens, but there
is no point in discussing the details now.)
From now on it will be important to distinguish between the QR decomposition
and the QR algorithm. The QR algorithm is an iterative procedure for finding
eigenvalues. It is based on the QR decomposition, which is a direct procedure
related to the Gram-Schmidt process. A single iteration of the QR algorithm will be
called a QR step or QR iteration.
Each QR step performs a unitary similarity transformation. We noted in Sec-
tion 5.4 that numerous matrix properties are preserved under such transformations,
including the Hermitian property. Thus if A is Hermitian, then all iterates Aj will be
Hermitian, and the sequence (Aj) will converge to diagonal form.
If Am-i is real, then Qm, Rm, and Am are also real. Thus if A is real, the basic
QR algorithm (5.6.1) will remain within the real number system.
Example 5.6.3 Let us apply the basic QR algorithm to the real symmetric matrix