The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Lecture



The QR algorithm is a numerical method in linear algebra for solving the complete eigenvalue problem, that is, for finding all the eigenvalues and eigenvectors of a matrix. It was developed in the late 1950s independently by V. N. Kublanovskaya and J. G. F. Francis.

The QR algorithm was preceded by the LR algorithm, based on LU decomposition. The QR algorithm is more stable than the LR algorithm and so has displaced it; the LR algorithm is little used today. It was, however, the first step toward the modern QR methods.

The LR algorithm was developed in the early 1950s by Heinz Rutishauser, who worked as an assistant to Eduard Stiefel at the Swiss Federal Institute of Technology (ETH) in Zurich. Stiefel suggested that Rutishauser use the sequence of moments u 0 T A k x 0 , k = 0, 1, ... (where x 0 and u 0 are arbitrary vectors) to find the eigenvalues of A . Rutishauser used Alexander Aitken's algorithm for this task and developed it into the quotient-difference algorithm (qd algorithm for short), from which the term qd algorithm derives.

After formulating it in a computationally suitable way, he discovered that the algorithm was in fact an iteration A k = L k U k ( LU decomposition ), A k +1 = U k L k , applied to a tridiagonal matrix, from which the algorithm derives LR

The QR Algorithm

Let A be a real matrix for which we want to find the eigenvalues and eigenvectors. Set A0=A. At the k-th step (starting from k = 0) we compute the QR decomposition Ak=QkRk, where Qk is an orthogonal matrix (that is, QkT = Qk−1), and Rk is an upper triangular matrix. We then define Ak+1 = RkQk.

Note that

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

that is, all the matrices Ak are similar, so their eigenvalues are equal.

Let all the leading principal minors of the matrix A be nondegenerate. Then the sequence of matrices Ak as The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart converges in form to a block upper triangular form, corresponding to blocks with eigenvalues equal in absolute value.

To obtain the eigenvectors of the matrix, one must multiply together all the matrices Qk.

The algorithm is considered computationally stable, since it proceeds by orthogonal similarity transformations.

Proof for a symmetric positive-definite matrix

Let us assume that the eigenvalues of the positive-definite matrix A are ordered by decreasing magnitude:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Let

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

and let S be the matrix composed of the eigenvectors of the matrix A. Then the matrix A can be written as a spectral decomposition

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Let us find an expression for the powers of the original matrix in terms of the matrices Qk and Rk. On the one hand, by definition of the QR algorithm:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Applying this relation recursively, we obtain:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Introducing the following notation:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

we obtain

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

On the other hand:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Equating the right-hand sides of the last two formulas, we obtain:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Suppose that an LU decomposition of the matrix ST exists:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

then

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Multiplying on the right by the inverse of U, and then by the inverse of Λk:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

It can be shown that

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

As The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, without loss of generality we may assume that the diagonal of the matrix L consists of ones, so that

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Let us denote

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

where the matrix Pk is upper triangular, being a product of upper triangular and diagonal matrices.

Thus we have proved that

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart.

From the uniqueness of the QR decomposition it follows that if the product of an orthogonal matrix and a triangular matrix converges to an orthogonal matrix, then the triangular matrix converges to the identity matrix. It follows that

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

That is, the matrices Sk converge to the matrix of eigenvectors of the matrix A.

Since

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

then

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Passing to the limit, we obtain:

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

Thus we have proved that the QR algorithm solves the complete eigenvalue problem for a symmetric positive-definite matrix.

Implementing the QR algorithm

Under certain conditions the sequence of matrices The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart converges to a triangular matrix, the Schur decomposition of the matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart. In this case the eigenvalues of the triangular matrix lie on its diagonal, and the problem of finding the eigenvalues is considered solved. In convergence tests it is not practical to require exact zeros in the zero part of the matrix, but one can use Gershgorin's circle theorem[en], which sets bounds on the errors.

In its original state (without any additional transformations) the matrix makes each iteration comparatively expensive. The cost of the algorithm can be reduced by first reducing the matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart to upper Hessenberg form (the cost of obtaining which, by the method based on the Householder transformation, is estimated at The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart arithmetic operations), and then using a finite sequence of orthogonal similarity transformations. This algorithm is somewhat similar to a two-sided QR decomposition. (In an ordinary QR decomposition the Householder reflection matrix is multiplied into the original matrix from the left only, whereas when using Hessenberg form the reflection matrix is multiplied into the original matrix from both the left and the right.) Finding the QR decomposition of an upper Hessenberg matrix is estimated at The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart arithmetic operations. Because the Hessenberg form is almost upper triangular (it has only one nonzero subdiagonal element), the number of iterations required for the QR algorithm to converge can be reduced significantly.

If the original matrix is symmetric, the upper Hessenberg matrix is also symmetric and therefore tridiagonal. The entire sequence of matrices The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart has this same property. In this case the cost of the procedure is estimated at The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart arithmetic operations using the method based on the Householder transformation. Finding the QR decomposition of a symmetric tridiagonal matrix is estimated at The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart operations.

The rate of convergence depends on the degree of separation of the eigenvalues, and in practical implementations “shifts” are used, explicitly or implicitly, to increase the separation of the eigenvalues and speed up convergence. In the typical case for symmetric matrices, the QR algorithm finds one eigenvalue exactly (reducing the dimension of the matrix) in one or two iterations, which makes this approach both efficient and reliable.

Implementing the QR algorithm implicitly

In modern computational practice the QR algorithm is implemented using its implicit version, which simplifies the addition of multiple “shifts”. Initially the matrix is reduced to upper Hessenberg form The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, just as in the explicit version. Then, at each step the first column of The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart is transformed, via a small-dimensional Householder similarity transformation, into the first column of The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart (or The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart), where The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart is a polynomial of degree The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart that determines the “shift” strategy (usually The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, where The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart and The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart are the two eigenvalues of the trailing 2×2 submatrix of The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, the so-called implicit double shift). Then successive Householder transformations of size The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart are carried out in order to bring the working matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart back to upper Hessenberg form.

Variants of the QR algorithm

Simple QR iteration

Let The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart be chosen. Then the procedure can be written in short as the QR decompositionThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart followed by re-forming The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, the multiplication being carried out in reverse order. This procedure is a direct generalization of the simultaneous power method for determining the first The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowcharteigenvalues of the matrix. This connection is derived from subspace iteration. The simultaneous inverse power method is likewise carried out indirectly.

QR algorithm with simple shifts

Let The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartbe set. This means that, as an alternative, the method can also be written as the QR decompositionThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart followed by re-forming, together with the shift correction, The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartas shown. Usually the shiftThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartis chosen so as to approximate the smallest eigenvalue. The last diagonal element can be usedThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartfor this purpose. The simple QR iteration is the result of setting all shifts to zero.

IfThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart has Hessenberg form, then so must The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, since as a product of a matrix with a subdiagonal and a matrix without one it likewise has Hessenberg form; the same applies toThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart. Thus, once the matrix in the QR algorithm has been reducedThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart to Hessenberg form, this form is preserved throughout the entire algorithm.

Simple shifts for symmetric matrices

A symmetric real matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowcharthas only real eigenvalues. Symmetry is preserved in all of them during the operation of the QR algorithmThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart. For symmetric matrices, Wilkinson (1965) proposed that the eigenvalue of the lower-rightThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartsubmatrix

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

that lies closer to The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartbe chosen as the shift. Wilkinson showed that the matrix sequence thus definedThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart converges to a diagonal matrix whose diagonal elements are the eigenvalues The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart. The rate of convergence is quadratic.

QR algorithm with double shift

A pair of simple shifts can be combined into a single iteration step. As a consequence, this means that for real matrices one can dispense with complex shifts. In the notation introduced above

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

The QR decomposition for the quadratic polynomial The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, is estimated at The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart. The coefficients of this polynomial are real even for a conjugate pair of complex shifts. Thus the complex eigenvalues of real matrices can also be approximated without using complex numbers in the computation.

The usual choice for this double shift consists of the eigenvalues of the lower-right The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartsubmatrix, i.e. the quadratic polynomial is the characteristic polynomial of this block,

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart.

QR algorithm with multiple shifts

Let a number The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart greater than The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartbut much smaller than the size The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart of the matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartbe chosen. The polynomialThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart can be regarded as the characteristic polynomial of the lower-right The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartsubmatrix of the current matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartto be used for the shift. Another strategy is to use theThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart eigenvalues of the lower-right The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartsubmatrix to be determined, together with The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart of the smallest eigenvalues The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartchosen below. With these, the QR decomposition

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart as well as The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

follows directly.

With repeated shifting it is often found that the lower-left The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartblocks in the sequence of iterated matrices become small particularly quickly, and thus the eigenvalue problem is split (deflated).

Implicit iteration with multiple shifts

Combining several shifts in the general form is very time-consuming. As mentioned above, the effort can be reduced by, at the preparatory stage, reducingThe QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart to Hessenberg form. Since each multi-shift step can consist of individual (even complex) shifts, the Hessenberg form is preserved throughout the entire algorithm.

This makes it possible to turn the QR algorithm into the “bulge-chasing” algorithm, which creates a bulge in the Hessenberg form at the upper end of the diagonal, then “chases” it down the diagonal, and finally pushes it out of the matrix at the lower end. .

  1. for The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart do
  2. Compute the polynomial The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart using one of the variants described above,
  3. Find the vector The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart.
  4. Determine the reflection The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartwith respect to the first unit vector. Since in The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart only the first The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchartcomponents are nonzero, this reflection has a simple block form.
  5. Form the matrix The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart and transform it so that The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart is returned to Hessenberg form.
  6. end for

We obtain The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart consisting of the products The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart, so let these blocks be of the diagonal form The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart.

Flowchart of the LC-QR algorithm

The QR algorithm for finding all eigenvalues and eigenvectors of a matrix: description and flowchart

See also

  • [[b8574]]

See also

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Numerical methods"

Terms: Numerical methods