Eigenvalues, singular values, rank

An eigenvalue that arrives twice

A matrix with forty distinct eigenvalues, handed to Lanczos for eighty steps, returns twenty-five extra copies of thirteen of them — the largest arriving five times. Every copy is accurate to 1.9·10⁻⁸ relative. No arithmetic error was made, nothing overflowed, and a caller counting eigenvalues gets the wrong multiplicity from a computation in which no individual number is wrong.

Worth reading first: Orthogonal is a number · The rate the condition number predicts.

An orthogonalisation nobody calls one builds the Arnoldi process for GMRES: a Krylov basis, built one vector at a time, orthogonalised against everything before it. Lanczos is the symmetric case of the same thing, and symmetry buys something remarkable — the orthogonalisation collapses to a three-term recurrence. Each new vector needs only the previous two, so a basis of any length costs one matrix–vector product and a handful of operations per step, and nothing has to be stored.

It is the most-used eigenvalue method there is at scale, and it is this site’s clearest case of an algorithm that fails by returning a plausible answer.

Copies of each eigenvalue after 80 steps on a 40×40 matrix with a simple spectrumA bar per eigenvalue that came back more than once, showing how many times. The matrix has 40 distinct eigenvalues by construction; the run returned 25 extra copies of 13 of them, the most-copied arriving 5 times. Every copy is accurate to 1.9·10⁻⁸ relative, which is why nothing but the true spectrum could detect them.λ = 105 timesλ = 9.55 timesλ = 95 timesλ = 8.55 timesλ = 2.952 timesλ = 2.92 timeseigenvalues that arrived more than once — the matrix has 40 distinct onesa spectrum with the wrong multiplicitiesextra copies, no reorthogonalisation25extra copies, full reorthogonalisation0worst relative error among the copies1.9·10⁻⁸steps taken of 80 asked for, full40no arithmetic error was madeevery one of these is right to eight digits
Fig. 1 How many times each eigenvalue came back, on a matrix whose forty eigenvalues are distinct by construction. The largest arrives five times. Every copy is accurate to 1.9·10⁻⁸ relative, which is why nothing but the true spectrum could detect them.

The recurrence, and what it promises

Start from a random vector, normalise, and repeat: multiply by A, subtract the components along the previous two vectors, normalise. After m steps there is an orthonormal basis Q of the Krylov space and a symmetric tridiagonal matrix T with QᵀAQ = T.

In exact arithmetic that is a similarity on the subspace, so the eigenvalues of T — the Ritz values — approximate A’s, and they approximate the extremes first and fastest. Run m = n steps and T is orthogonally similar to A and has its spectrum exactly.

That claim is checked here before anything else. With full reorthogonalisation at m = n = 24 the tridiagonal’s spectrum agrees with the prescribed one to a worst relative error of 5.5·10⁻¹⁵, and ‖QᵀQ − I‖ is 1.6·10⁻¹⁵. If that failed, every number below would be measuring a bug rather than a phenomenon.

Without it, the basis stops being a basis

‖QᵀQ − I‖ at every step of a Lanczos run, n = 40The departure from orthogonality of the Lanczos basis, against the step, on a logarithmic vertical axis. It sits at the level of rounding for 13 steps and then climbs by a factor of about seventeen a step for ten steps running, twelve orders of magnitude, before saturating. The dashed line marks the step at which the first Ritz value converged, which is step 11.051015202530354010⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹step‖QᵀQ − I‖first Ritz value converges√uno reorthogonalisationfullthe two events are one eventstep orthogonality crosses √u14step the first Ritz value converges11consecutive steps at ≥5× growth10a drift would grow like a square rootthis grows like a geometric series and then stops
Fig. 2 ‖QᵀQ − I‖ at every step of a 40-step run, with and without reorthogonalisation. The plain recurrence sits at the level of rounding for thirteen steps, then climbs by about a factor of seventeen a step for ten steps running, and saturates. The dashed line is the step at which the first Ritz value converged.

The measurement worth having is not that orthogonality is lost — everything loses orthogonality — but the shape of the loss. Measured at n = 40:

10⁻¹⁶ … 10⁻¹³ for ten steps, then
3·10⁻¹²  5·10⁻¹¹  9·10⁻¹⁰  2·10⁻⁸  2·10⁻⁷  4·10⁻⁶  10⁻⁴  10⁻³  3·10⁻²  4·10⁻¹  1

A factor of about seventeen a step, for ten consecutive steps, twelve orders of magnitude — and then flat, at order one, because ‖QᵀQ − I‖ cannot grow once the vectors have stopped being independent.

That is not what accumulated rounding error looks like. Accumulated error grows like the square root of the step count and keeps going; this is geometric over a run and then saturates, which is the signature of a mechanism rather than of an accumulation.

The first version of this assertion looked for a single large jump, which is the shape the word “collapse” suggests. It is not what happens: the largest one-step ratio is 21.8, which a drift could plausibly produce once. The run is the signature, not the jump, and asserting the jump would have been asserting a property the data does not have while the property it does have went unchecked.

The residual basis of conjugate gradients, at κ = 106A semi-logarithmic plot against iteration count showing the loss of orthogonality among the residual vectors rising while the relative residual falls.05101520253010⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹iteration‖RᵀR − I‖ and ‖r‖/‖b‖step n‖RᵀR − I‖residual30×30, run for exactly n stepsexact arithmetic would end here
Fig. 3 The same quantity inside a conjugate gradient solve, from the iterative field. There the residual basis loses orthogonality too — ‖RᵀR − I‖ = 5.29 after n steps — and the mechanism is different: it is governed by the conditioning of the Krylov vectors rather than by anything having converged.

And it happens exactly when something converges

The dashed line on that figure is the step at which the first Ritz value first reaches full accuracy against the true spectrum. Orthogonality crosses √u at step 14 and the first Ritz value converges at step 11.

That is Paige’s result, and it is what turns this from an unfortunate numerical behaviour into an explicable one. The loss of orthogonality is not random and it is not uniform: it happens in the direction of a converged Ritz vector. The recurrence, having found an eigenvector, starts losing orthogonality specifically against that eigenvector — and the component it loses grows until the next basis vector has a substantial piece of it.

Which is why the ghost is a copy rather than noise. The algorithm has effectively restarted in a direction it already explored, so it rediscovers the eigenvalue it already found, to full accuracy, as many times as the run permits.

assertTheCollapseTracksConvergence asserts the two step numbers agree to within three, which is a claim that could have come out the other way and is the only evidence here that the mechanism is the one named.

What comes back

At n = 40, eighty steps:

eigenvalue copies
10.0 5
9.5 5
9.0 5
8.5 5
2.95 … 2.80 2 each
1.40 … 1.20 2 each

Twenty-five extra copies across thirteen eigenvalues, on a matrix whose forty eigenvalues are distinct by construction. The four well-separated ones at the top — the ones Lanczos converges on first, and therefore the ones it loses orthogonality against first — arrive five times each.

And the copies are accurate. The worst relative error among them is 1.9·10⁻⁸. That is eight correct digits from a computation that has made no arithmetic error, and it is what makes them undetectable: a caller looking at the Ritz values sees five numbers agreeing to eight digits and concludes, reasonably, that an eigenvalue of multiplicity five has been found to high precision.

The counting rule is deliberately strict about this. A duplicate requires two Ritz values near the same true eigenvalue — not merely two Ritz values near each other, which is the method working when the eigenvalues are genuinely close. A lazier count would report the site’s own clustered test spectrum as full of ghosts.

Copies of each eigenvalue after 120 steps on a 40×40 matrix with a simple spectrumA bar per eigenvalue that came back more than once, showing how many times. The matrix has 40 distinct eigenvalues by construction; the run returned 71 extra copies of 40 of them, the most-copied arriving 8 times. Every copy is accurate to 2.3·10⁻⁸ relative, which is why nothing but the true spectrum could detect them.λ = 108 timesλ = 9.58 timesλ = 97 timesλ = 8.57 timesλ = 2.953 timesλ = 2.93 timeseigenvalues that arrived more than once — the matrix has 40 distinct onesa spectrum with the wrong multiplicitiesextra copies, no reorthogonalisation71extra copies, full reorthogonalisation0worst relative error among the copies2.3·10⁻⁸steps taken of 120 asked for, full40no arithmetic error was madeevery one of these is right to eight digits
Fig. 4 Fifty per cent more steps on the same matrix. Seventy-one extra copies rather than twenty-five, and the most-copied eigenvalue arrives eight times rather than five — more of them rather than better versions of the same ones, which is what separates a mechanism from an artefact of where the run stopped.

It is a mechanism, not an artefact of stopping

The distinction that makes this worth an assertion rather than a remark. A fixed set of duplicates could be an accident of where the run happened to stop. A count that grows with the run is the recurrence continuing to lose orthogonality against each newly converged Ritz vector.

Eighty steps give 25 extra copies with the largest eigenvalue arriving five times. A hundred and twenty steps give 71, with the largest arriving eight times. Running longer produces more of them rather than better versions of the same ones.

There is a second termination fact in the same measurement, and it is the sharpest single sentence in this essay. Full reorthogonalisation stops at exactly step n. Asked for eighty steps on a 40×40 matrix it takes forty and stops, because β falls below the tolerance — the Krylov space has dimension n and there is genuinely nothing left. The plain recurrence asked for eighty takes eighty, and the extra forty vectors are built entirely out of the orthogonality it has lost.

An algorithm that does not notice it has exhausted its own search space is producing output from rounding error, and continues to do so indefinitely.

The cheap repair, and why it is enough

What each reorthogonalisation costs and what it leaves, n = 40Two quantities for three variants on one logarithmic axis: the number of projections performed, and the departure from orthogonality left behind. Doing nothing costs nothing and leaves a basis that is not one. Full reorthogonalisation costs 820 projections and leaves 1.9·10⁻¹⁵. Selective costs 137 — 6.0 times fewer — and leaves 10·10⁻⁸, which is √u and is enough.010⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹count, and ‖QᵀQ − I‖√u — semi-orthogonalitynoneselectivefullprojections‖QᵀQ − I‖two counters, three methodsghosts, none4ghosts, selective0selective is cheaper by6the cheap repair leaves a basis that is not orthogonaland that is the claim, not a shortfall
Fig. 5 Two counters for three variants at n = 40: the projections performed, and the departure from orthogonality left behind. Doing nothing costs nothing and leaves a basis that is not one. Full reorthogonalisation costs 820 projections. Selective costs 137 — six times fewer — and leaves 10⁻⁷, which is √u and is enough.

Full reorthogonalisation projects each new vector against every previous one. It works completely and it costs O(n²) projections and O(n²) storage, which is the whole of what the three-term recurrence was for.

Selective reorthogonalisation — Parlett and Scott’s — projects only against the converged Ritz vectors, and only when the estimate says orthogonality has decayed to √u. It works because the directions that matter are exactly the ones Paige’s theory names: orthogonality is not being lost uniformly, it is being lost against converged Ritz vectors, so repairing those repairs all of it.

Measured at n = 40, m = n:

variant projections ghosts ‖QᵀQ − I‖
none 0 4 3.93
selective 137 0 9.97·10⁻⁸
full 820 0 1.91·10⁻¹⁵

Six times cheaper, and zero ghosts. And the basis it leaves is not orthogonal to rounding — it is at 10⁻⁷, which is √u to within a factor of seven.

That is the claim rather than a shortfall, and it is asserted in that direction. Below √u the square of the lost orthogonality is under u, and the Ritz values are then as accurate as the precision permits; nothing is bought by going further. assertTheLanczosAssertionsReject feeds the claim that the selectively reorthogonalised basis is fully orthogonal and requires it to fail — the opposite mistake to the obvious one, and the one that would make the cheap method look like the dear one.

Why the comparison runs to exactly n steps

Worth stating because getting it wrong reverses the answer.

Run the comparison to 80 steps on a 40×40 matrix and the numbers come out 2,352 projections for selective against 820 for full — the wrong way round, by a factor of three. That is not a measurement of reorthogonalisation. It is charging the cheap method for forty steps the dear one correctly declined to take, since full reorthogonalisation stopped at step 40 and the others did not.

The Krylov space has dimension n. A comparison run past it compares a method that has finished against two that are producing vectors out of rounding error, and any cost per step is then a cost of running when there is nothing left to do.

Jacobi sweeps on the 6×6 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.6190.24240.016326.157·10⁻⁴1.257·10⁻⁵1.083·10⁻⁷κ = 1.5·10⁷‖VᵀV − I‖ = 1.9·10⁻¹⁵1.000.500.330.250.200.170.500.330.250.200.170.140.330.250.200.170.140.130.250.200.170.140.130.110.200.170.140.130.110.100.170.140.130.110.100.09as given1.620.050.00-0.040.00-0.000.050.240.000.010.00-0.000.000.000.000.00-0.00-0.00-0.040.010.000.020.000.000.000.00-0.000.000.00·-0.00-0.00-0.000.00·0.00after one sweep1.62······0.24······0.00······0.02······0.00······0.00after 8 sweepseach sweep is n(n−1)/2 rotationsthe trace is conserved
Fig. 6 The other way this site computes a symmetric spectrum. Jacobi rotations sweep the whole matrix and drive the off-diagonal norm to zero, which costs O(n³) and cannot return an eigenvalue twice — the economy Lanczos buys is exactly what exposes it to this.

What this says about multiplicity

Rank is a decision establishes that a floating-point matrix does not have a rank — that a numerical rank is a decision about a gap, and the gap is worth printing beside it.

A multiplicity read off a Lanczos run is worse than a decision. It is not a threshold applied to a quantity that has a gap somewhere; it is a count of numbers the algorithm produced, and the algorithm produces as many as it is allowed to. The right number is not recoverable from the output at all: five copies of 10.0 and a genuine eigenvalue of multiplicity five are the same list of numbers.

What separates them is whether the basis was orthogonal, which is a fact about the run rather than about the answer — and it is not in the answer. Which is the whole reason assertTheGhostsAreCopies compares against a prescribed spectrum: without one, there is no way to know.

The 12×12 grid Laplacian and its Cholesky factor, ordered by nested dissectionTwo square sparsity plots side by side. The left shows the nonzeros of the matrix; the right shows the nonzeros of its Cholesky factor, with the entries created by elimination marked in a second colour.the matrix, lower triangle408 entriesits Cholesky factor1413 entries · 1005 created‖A − LLᵀ‖/‖A‖1.1·10⁻¹⁶fill, symbolic1005fill, numeric1005n = 144 · density 3.2% · bandwidth 108same matrix, renumberedthe answer is identical to rounding
Fig. 7 Why nothing here is formed densely. A matrix of a million unknowns is stored by its nonzeros, a matrix–vector product costs one pass over them, and a method needing only that is the difference between a computation and no computation — which is the whole of what the three-term recurrence buys.

The economy that was the point

Worth restating why anybody accepts this behaviour, because the essay so far reads as a catalogue of defects.

The three-term recurrence is what makes Lanczos usable at scale, and the economy is total. One matrix–vector product per step. Two vectors of storage. No orthogonalisation against a growing basis, so the cost per step does not grow with the step count — which is exactly what Arnoldi cannot offer, and is why the non-symmetric case is a harder engineering problem than the symmetric one despite being the same idea.

For a matrix of a million unknowns stored sparsely, that is the difference between a computation and no computation. Full reorthogonalisation gives it all back: O(m) storage becomes O(nm), and O(1) work per step becomes O(m).

So the trade is not “a correct method against a broken one”. It is a method whose cost does not grow against a method whose cost does, and selective reorthogonalisation exists because Paige’s analysis says the growing part can be restricted to the converged Ritz vectors — a set that grows far more slowly than the basis does.

The measurement in the figure is that restriction paying: 137 projections against 820, zero ghosts, and a basis at √u. The reason it is only six times cheaper here rather than a hundred is that n = 40 is a small matrix in which nearly everything converges. On a problem where forty extreme eigenvalues are wanted out of a million, the ratio is the ratio of forty to a million.

What the badge on a spectrum figure should say

A small note about the figures, because this family departs from the site’s usual pattern.

None of the three draws a factorisation, so residualcheck does not require a residual badge, and all three carry one. ghost-ladder’s prints the extra copies with and without reorthogonalisation, the worst relative error among the copies, and how many steps the full run actually took of the number it was asked for. orthogonality-collapse’s prints the two step numbers whose agreement is the mechanism.

The site’s rule is no decomposition without its residual printed, and the habit underneath it is that the number a figure rests on belongs on the figure rather than in prose a reader may not reach. Where the two come apart — a figure with no factorisation and a load-bearing number — the habit is the one worth keeping, and a Lanczos run’s load-bearing number is ‖QᵀQ − I‖, which is the same quantity this site has printed on QR figures since its first phase.

‖QᵀQ − I‖ at every step of a Lanczos run, n = 24The departure from orthogonality of the Lanczos basis, against the step, on a logarithmic vertical axis. It sits at the level of rounding for 13 steps and then climbs by a factor of about seventeen a step for ten steps running, twelve orders of magnitude, before saturating. The dashed line marks the step at which the first Ritz value converged, which is step 11.0481216202410⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹step‖QᵀQ − I‖first Ritz value converges√uno reorthogonalisationfullthe two events are one eventstep orthogonality crosses √u14step the first Ritz value converges11consecutive steps at ≥5× growth10a drift would grow like a square rootthis grows like a geometric series and then stops
Fig. 8 The same collapse on a smaller matrix. It arrives at roughly the same step rather than proportionally earlier, because the trigger is convergence on the extreme eigenvalues rather than accumulated arithmetic — a drift would arrive later on a larger problem and this does not.

The site’s third orthogonality loss, and the first with a different cause

Worth putting beside the other two, because the measurement is the same and the mechanism is not.

Two Gram–Schmidts measures ‖QᵀQ − I‖ against the condition number: classical loses like κ², modified like κ, Householder flat at 1.8·10⁻¹⁵ across eleven decades. The cause is cancellation in the projection step, and it is worst when the columns are nearly dependent.

An orthogonalisation nobody calls one measures the same quantity on an Arnoldi basis inside GMRES, where the loss is again a cancellation and is again governed by how nearly dependent the Krylov vectors are.

Here the loss is governed by convergence. It has nothing to do with the conditioning of the matrix — the test spectrum is a set of well-separated integers and the matrix is perfectly conditioned — and everything to do with the algorithm having found something. A well-conditioned problem, a stable step, and a basis that falls apart on schedule.

Which is why the same measurement needed a different figure. A plot against κ would be flat and would say nothing; the plot that says something is against the step, with the convergence event marked on it. The quantity is the site’s oldest and the axis is new.

Why a random starting vector, and why one seed

Two construction details that decide what the figures show.

The starting vector is random rather than e₁, and the matrix is VΛVᵀ for a fixed random orthogonal V rather than diagonal. Lanczos started from e₁ on a diagonal matrix converges in one step and shows nothing at all — the Krylov space is spanned immediately — so a figure drawn that way would be a figure of a degenerate case.

And there is one seed, fixed, because every figure on this site is byte-identical on every build. That is a real limitation here and it is stated rather than hidden: the step at which the first Ritz value converges depends on how much of the leading eigenvector the starting vector happened to contain, so the numbers 14 and 11 are one draw. What is not one draw is that the two events coincide, which is asserted across every size in the family gate — three sizes, each with its own run — and which is the claim the essay actually makes.

What is left

Restarting. Nobody runs Lanczos to n steps on a large problem; the whole point is to stop early with a few extreme eigenvalues. Implicitly restarted Lanczos — the algorithm ARPACK implements and most large eigenvalue computations actually run — keeps a fixed-size basis and restarts with a filtered starting vector, and its interaction with the loss of orthogonality is a subject of its own.

Block Lanczos, which handles genuine multiplicities properly by carrying several vectors at once — and which is the actual answer to the question this essay poses, since a genuine multiplicity of five is invisible to the single-vector recurrence for a completely different reason.

And the non-symmetric case. Arnoldi has no three-term recurrence, so its orthogonalisation cost grows with the step count whether or not anything has converged, and the trade-offs are different. This site builds Arnoldi in the GMRES essay and measures its orthogonality loss there; what it does not have is the eigenvalue version, where the Ritz values are complex and the convergence theory is much weaker.

What links here

Computed from the collection, not written here: the essays that point at this one.

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.

EigenvaluesKrylov subspaceLanczos algorithmMultiplicityOrthogonalityReorthogonalisationRitz valuesThree term recurrence