Eigenvalues, singular values, rank

Two shifts that are never formed

The double shift is defined as a factorisation of (A − μI)(A − μ̄I), which nobody computes. What is computed is the first column of that product — three numbers — and the bulge those three numbers create, pushed down the subdiagonal by n − 2 reflectors until it falls off the bottom.

Worth reading first: The form a real matrix can reach · The algorithm the libraries actually run.

The algorithm the libraries actually run establishes that the QR algorithm is unusable without a shift and cubic with one, and measures both: 248 iterations against 6 on a matrix with a spectrum of 8, 4, 2, 1.8, and outright failure on a matrix with eigenvalues ±1.

The shift it uses is Wilkinson’s, and Wilkinson’s shift is a real number. On a matrix whose trailing block has a conjugate pair, that real number is trying to approximate an eigenvalue which is not on the real line, and it cannot.

After reflector 2 of 5: the bulge in column 1A square matrix drawn as a grid with one nonzero subdiagonal. A small triangle of entries below that subdiagonal is highlighted, and moves down the matrix from panel to panel.0.46-1.11.5-0.470.2-0.181.90.690.42-0.160.028-0.0160-1.50.160.880.099-0.1100.680.762.30.930.0480-0.250.110.952.11.500001.52.3after reflector 2the highlighted entries are the bulge — the only thing that is not Hessenbergentries below the subdiagonal3reflectors used2reflectors in a whole step5the shifts are never formed — only their sum and productand both of those are real
Fig. 1 What a double shift is. The highlighted entries are the bulge — the only part of the matrix that is not upper Hessenberg — and each reflector moves it down and to the right by exactly one. Drag through the reflectors and watch it fall off the bottom.

The measurement, before the algorithm

The failure is worth running rather than describing, and the site runs it.

Take a 4×4 real matrix built from the spectrum {1 + 2i, 1 − 2i, 4, −1}. Give it to the single-shift algorithm with Wilkinson’s shift, 200 iterations, a tolerance of 10⁻¹². It does not converge. The subdiagonal entry it is chasing moves by 5.8·10⁻¹⁵ between the hundredth iteration and the two hundredth, which is to say it does not move at all.

That is the same signature as the ±1 failure in the symmetric field, and the cause is the same shape: the shift is stuck at a distance from the eigenvalues it is trying to reach, so the ratio governing convergence is 1. The difference is that on ±1 a shift fixes it in one step, and here no real shift exists that would.

The double shift settles the same matrix in seven double steps.

Shifting by both at once

The idea is one sentence. If μ is a complex shift then so is μ̄, because the matrix is real and its complex eigenvalues come in pairs. Do both, one after the other:

(AμI)(AμˉI)=A2sA+tI,s=μ+μˉ,t=μμˉ(A - \mu I)(A - \bar\mu I) = A^2 - sA + tI, \qquad s = \mu + \bar\mu, \quad t = \mu\bar\mu

and both s and t are real — a sum of conjugates and a product of conjugates. So the operator being factorised is a real matrix, the QR factorisation of it is real, and the resulting similarity is real. The complex shift is used and never formed.

In practice s and t come straight from the trailing 2×2 block: s is its trace and t is its determinant, so the two shifts are that block’s eigenvalues and neither is ever computed. When the block’s eigenvalues happen to be real, the same step performs two real shifts at once and works perfectly well; nothing has to detect which case it is in.

That is the whole of the mathematical content, and it would be an unusable algorithm as stated. Forming A² costs O(n³), destroys the Hessenberg structure that the form that makes it affordable established is the only reason the iteration is cheap, and squares the condition number of everything in sight.

The implicit version

What is done instead uses a theorem to avoid the product entirely.

The implicit Q theorem says that if two orthogonal similarities both reduce A to unreduced upper Hessenberg form and their first columns agree, then they agree up to the signs of their columns. So a step is determined by its first column alone.

The first column of A² − sA + tI is available for three multiplications, because A is Hessenberg: it has exactly three nonzero entries, and they are

x=a112+a12a21sa11+t,y=a21(a11+a22s),z=a32a21.x = a_{11}^2 + a_{12}a_{21} - s\,a_{11} + t, \quad y = a_{21}(a_{11} + a_{22} - s), \quad z = a_{32}a_{21}.

Build the 3×3 Householder reflector that maps [x, y, z] to a multiple of e₁ and apply it as a similarity. That is the first column right, and by the theorem the rest of the step is determined — so all that remains is to restore Hessenberg form without disturbing the first column, which fixes everything.

Restoring it is the bulge chase, and it is what the figure draws.

The bulge, measured

Applying that first reflector to rows 1–3 and columns 1–3 puts entries where the Hessenberg form has none. The site locates them rather than describing them, and the shape is exact:

after reflector entries below the subdiagonal where
1 3 (3,1) (4,1) (4,2)
2 3 (4,2) (5,2) (5,3)
3 3 (5,3) (6,3) (6,4)
4 1 (6,4)
5 0

A three-entry triangle, moving down and right by exactly one each time, shrinking to a single entry and then gone. On a 6×6 that is five reflectors, which is n − 1, and each one costs O(n) work — so a whole double step is O(n²), the same as a single shifted step, and half as many of them are needed.

The site asserts the leftmost column of the bulge is the reflector’s own index, which is the version of the claim with no off-by-one available to it. The first version of that check looked for “two entries below the subdiagonal” and measured the lowest row, which starts at 3 rather than 2 — the right-hand application of a reflector reaches one row further than the left-hand one, so the bulge is a triangle rather than a pair. The assertion was wrong about the shape of the thing it was asserting about, and the figure it produced would have been wrong in the same way.

After reflector 4 of 5: the bulge in column 3A square matrix drawn as a grid with one nonzero subdiagonal. A small triangle of entries below that subdiagonal is highlighted, and moves down the matrix from panel to panel.0.46-1.1-1.6-0.260.00780.0231.90.69-0.44-0.036-0.0330.01201.6-0.12-0.14-0.022-0.009700-0.32.60.440.120000.442.21.70000.111.72.2after reflector 4the highlighted entries are the bulge — the only thing that is not Hessenbergentries below the subdiagonal1reflectors used4reflectors in a whole step5the shifts are never formed — only their sum and productand both of those are real
Fig. 2 The last reflector but one, with a single entry left. Everything above and to the left is Hessenberg again, and one more reflector pushes the remaining entry off the bottom edge of the matrix.

Checked against the thing it avoids

The implicit Q theorem is the licence for all of this, and citing a theorem is not this site’s habit. So both routes are computed — on a matrix small enough that forming the product is affordable — and required to agree.

The explicit route forms M = A² − sA + tI, factorises it by Householder QR, and applies the factor: QᵀAQ. The implicit route computes M’s first column, builds one reflector from three numbers, and chases a bulge.

They agree to 2.2·10⁻¹⁵ on a matrix of norm 5.8, which is rounding.

The comparison is made on absolute values entry by entry rather than as a norm of a difference, and that is not a fudge. “Essentially unique” in the implicit Q theorem means up to the signs of the columns, and the two routes make different sign choices in their reflectors — a Householder vector’s sign is chosen for numerical reasons, and the two constructions choose differently. A norm of the difference would be about 8, and the claim being checked is a claim about the matrices being the same up to those signs.

Being precise about that is worth more than taking a norm and finding it small. A check that would have passed for the wrong reason is not evidence, and a check that fails because the claim was stated imprecisely sends the next reader to break something that works.

The real Schur form with 1 conjugate pair: 1 block that cannot be splitA square matrix drawn as a grid. Everything below the diagonal is zero except for a small number of two-by-two boxes on the diagonal, which are highlighted.-2000000120000-2100000030000004.50000000.8T = ZᵀAZthe highlighted boxes each hold one conjugate pair, and no real rotation removes themthe form, and that it is one‖A − ZTZᵀ‖/‖A‖4.5·10⁻¹⁵‖ZᵀZ − I‖5.5·10⁻¹⁵worst eigenvalue error9.8·10⁻¹⁵surviving subdiagonal26×6, spectrum chosen before the matrix was builtquasi-triangular is as far as the reals go
Fig. 3 What the chase is chasing towards. Repeat the double step, deflate when a subdiagonal entry becomes negligible, and what is left is the quasi-triangular form — with one block per conjugate pair and nothing else below the diagonal.

Deflation, and the shift nobody advertises

Two details that a description of the algorithm usually omits and a working one cannot.

Deflation. After each step the subdiagonal is scanned for entries small relative to their neighbouring diagonal entries; those are set to zero and the problem splits. Without it the iteration would keep working on a full matrix long after most of its eigenvalues had converged, and the cost would be multiplied by n. The site records where each deflation happened, which is also how the block count is read off at the end.

The exceptional shift. A double step whose shifts are the trailing block’s eigenvalues can stall, on a matrix with a symmetry the shift happens to share — the same failure the unshifted algorithm has on ±1, one level up. Every production implementation carries an ad-hoc shift for it: after some number of iterations without a deflation, replace s and t with values derived from the size of the subdiagonal entries rather than from the block, break the symmetry, and carry on.

That is genuinely a hack and it is in every library. It is worth naming for the same reason the swap that is not optional is worth writing: an algorithm presented without the part that stops it looping is an algorithm presented as more elegant than it is. And an implementation without one does not fail — it runs forever, which is worse.

Why the product would have been worse than slow

The usual objection to forming A² − sA + tI is the cost, and the cost is the least of it. Three separate things go wrong and only one of them is arithmetic.

The structure. A is Hessenberg, so it has about n²/2 nonzeros. A² is full. Forming it therefore throws away the reduction that the form that makes it affordable measures as the difference between an O(n²) step and an O(n³) one, and it throws it away at every iteration rather than once.

The conditioning. Squaring a matrix squares its condition number, which is the same failure the road that squares the problem records about the normal equations. The eigenvalues of A² are the squares of A’s, so two eigenvalues separated by a relative gap of 10⁻⁶ in A are separated by 10⁻¹² in A², and a shift computed from a matrix in which they have merged is not a useful shift.

And the shifts themselves are near-cancelling. When the double shift is doing its job, s and t are close to the trailing block’s own trace and determinant, so A² − sA + tI is close to singular by construction — that is the entire point, since a nearly singular operator is what makes the QR step converge. Forming a nearly singular matrix explicitly and then factorising it is the shape of computation this site spends most of its foundation warning about.

The implicit route sidesteps all three at once, and it does so without any accuracy argument of its own: it never forms the product, so there is nothing for the product’s conditioning to damage. The only thing the implicit route computes from the product is its first column, which is three entries built from six multiplications, and a reflector built from three numbers cannot inherit a condition number.

That is a pattern worth naming because it recurs. The cheapest route and the most accurate route are the same route, and they are the same route for the same reason — both are consequences of not forming an intermediate object that nobody wanted. Householder QR against the normal equations is the same shape; computing a residual rather than an inverse is the same shape; and an orthogonalisation nobody calls one makes the same observation about the Krylov basis. It is one of the few places in this subject where there is no trade to describe.

What is asserted here

The bulge is three entries and moves one column per reflector, at every reflector but the last two, with the column index checked against the reflector’s own index.

A whole double step takes n − 1 reflectors, and the last one leaves nothing below the subdiagonal — which is the claim that the step restores Hessenberg form rather than merely reducing the damage.

The implicit step is the explicit one, entry by entry in absolute value, to 2.2·10⁻¹⁵.

A = ZTZᵀ and ZᵀZ = I, printed on every figure in this family, because realSchur returns a factorisation and this site does not draw one without them.

The refusal: that a single real shift converges on a matrix with a conjugate pair. It is run for two hundred iterations and refuses, and the drift of the entry it is chasing is separately asserted to be under 10⁻⁶ of the norm — so the refusal is about an entry that does not move rather than about one that is moving slowly.

The spectrum in the plane, with the pair at 1 ± 1.50iA complex plane with the real axis marked. Open circles show the eigenvalues the matrix was built from and filled dots show the ones the algorithm returned; two of them sit symmetrically above and below the real axis.-5-3-1135-202real partimaginary partbuilt incomputedthe real line — where a real shift lives‖A − ZTZᵀ‖/‖A‖2.1·10⁻¹⁵‖ZᵀZ − I‖3.7·10⁻¹⁵worst eigenvalue error4.4·10⁻¹⁵departure from normality10⁻¹⁸5×5 real matrix, 1 conjugate pairthe answer is not on the axis
Fig. 4 The two shifts, drawn where they live. They are the eigenvalues of the trailing block, they are off the real axis, and the algorithm uses both without ever writing either of them down — only their sum and their product, which are on the axis.
Householder reduction to Hessenberg form, on a symmetric 6×6Two matrices side by side. The first is full; the second has zeros everywhere below the first subdiagonal, and being symmetric is tridiagonal.-0.16-0.63-0.493.43-0.025-0.632.3-0.69-0.95-1.70.076-0.49-0.694.3-1.6-1.41.93.4-0.95-1.65.40.0141.63-1.7-1.40.0144.60.055-0.0250.0761.91.60.0553.1A, symmetric-0.164.600004.65.92.500002.51-1.20000-1.24.90.3800000.385.80.2400000.242H = QᵀAQ, tridiagonal‖A − QHQᵀ‖/‖A‖1.1·10⁻¹⁵below the subdiagonal0worst eigenvalue movement7.1·10⁻¹⁵a similarity, so the spectrum is untouched — and every later step is O(n²) rather than O(n³)one reduction, then every iteration is cheapthe eigenvalues did not move
Fig. 5 The structure the chase preserves. Reduction to Hessenberg costs O(n³) once, and the whole point of the bulge chase is that a double step leaves that structure exactly as it found it, so the cost is paid once rather than at every iteration.
Driving the subdiagonal to zero, with λ₄/λ₃ = 0.60A semi-logarithmic plot of the magnitude of the subdiagonal entry against iteration count for three shift strategies. The unshifted curve is a straight line; the two shifted curves plunge to the bottom of the plot within a few steps.0918273645546310⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹iteration|subdiagonal entry|no shiftRayleighWilkinsontwo routes to one raterate, from the spectrum0.6rate, measured0.6iterations, none / Wilkinson8.6symmetric 4×4, spectrum 8, 4, 2, 1.2the dashed line is the prediction
Fig. 6 The symmetric field’s version, where a single shift is enough and the convergence can be plotted as one falling curve. Nothing in this essay has a picture of that kind, because the quantity that would be plotted belongs to a block that is not going to zero.
Jacobi sweeps on the 7×7 Hilbert matrixA plot of the off-diagonal norm against sweep number, falling from about one to ten to the minus seventeen in five sweeps, with the matrix shown at three stages beneath it.01234567810⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹sweep‖off-diagonal‖eigenvalues, largest first1.6610.27190.021290.0010092.939·10⁻⁵4.857·10⁻⁷3.494·10⁻⁹κ = 4.8·10⁸‖VᵀV − I‖ = 2.4·10⁻¹⁵1.00.50.30.30.20.20.10.50.30.30.20.20.10.10.30.30.20.20.10.10.10.30.20.20.10.10.10.10.20.20.10.10.10.10.10.20.10.10.10.10.10.10.10.10.10.10.10.10.1as given1.70.1-0.0-0.0-0.0-0.0-0.00.10.30.00.00.0-0.0-0.0-0.00.00.00.0-0.0-0.00.0-0.00.00.00.00.00.0-0.0-0.00.0-0.00.00.00.0-0.0-0.0-0.0-0.00.00.00.0·-0.0-0.00.0-0.0-0.0·0.0after one sweep1.7·······0.3·······0.0·······0.0···············0.0·······0.0after 8 sweepseach sweep is n(n−1)/2 rotationsthe trace is conserved
Fig. 7 And the algorithm the foundation used instead. Jacobi is provably convergent, needs no shift, no deflation and no exceptional case, and is not what any library runs — which is the gap the whole of this field exists to close.

What Francis’s paper actually changed

It is worth being clear about which part of this was the contribution, because the double shift and the implicit step are usually described together and only one of them was new.

Shifting by a conjugate pair to stay in real arithmetic is the obvious move once the problem is stated, and it was known. What was not obvious is that the whole step can be performed without forming the shifted operator — that a reflector built from three numbers plus a mechanical restoration of Hessenberg form is provably the same similarity. That is the implicit Q theorem being used as an algorithm rather than as a fact, and it is what turned an O(n³)-per-iteration method into an O(n²)-per-iteration one.

The consequence is that the algorithm in LAPACK’s dhseqr today is recognisably the 1961 algorithm. It has acquired multishift versions, which chase several bulges at once so that the arithmetic can be done as dense matrix-matrix products and reach a useful fraction of a machine’s peak throughput; it has acquired aggressive early deflation, which detects convergence sooner by examining a trailing window rather than a single entry; and it has acquired a great deal of care about the exceptional shift. None of those change the step. They change how many are done at once and how quickly a converged eigenvalue is noticed.

That longevity is unusual in this subject and it is worth a sentence about why. The methods that get replaced are the ones whose cost model was wrong for the hardware — the normal equations, explicit inverses, Jacobi’s sweep over all pairs. The methods that survive are the ones whose inner loop is a small orthogonal transformation applied to a structured matrix, because that inner loop keeps being implementable well on whatever the machines turn out to be. Householder QR is the other example, and a reflection cannot stop being one makes the same observation about it from the accuracy side.

The bulge chase is the same object seen from the cost side: a sequence of tiny orthogonal transformations, each touching three rows and three columns, arranged so that the structure the expensive reduction created is never lost.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Bulge chasingDeflationFrancis's double shiftHessenberg formHouseholder reflectionThe implicit Q theoremJacobi's eigenvalue methodOrthogonalityShifts