The matrix that is a graph

The vertex nobody solves for

A Laplacian is singular, so every solve with one has to remove its kernel first. There are three ways, they agree to fourteen digits, and the one everybody uses carries a free parameter that no account of the method mentions and that moves the condition number by nine hundred.

Worth reading first: A matrix with no numbers in it · The condition number is an amplifier.

Every Laplacian is singular. That is not a defect of a particular graph or an artefact of a discretisation; it is the definition. The rows sum to zero, so the vector of ones is in the kernel, and a system Lx = b has either no solution or a whole line of them.

The line is not an inconvenience — it is the physics, and the kernel is known exactly rather than computed. L is a network of conductances, b is a set of injected currents, and x is a potential. Potentials are defined up to a constant, and a solver being asked to return one has to be told which constant. Nothing in the matrix says.

One system, 30 ways to remove its kernel, and 898× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the star 30: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 1, of degree 1, gives κ = 898; grounding vertex 0, of degree 29, gives 1 — a factor of 898 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.1611162126110¹10²10³degree of the grounded vertexcondition number of what is left1, the best choicea parameter nobody setsvertices tried30best κ1at degree29worst κ898at degree1spread898one row and column deletedand it matters which
Fig. 1 Thirty ways to remove the kernel of one system, by deleting one row and column, plotted against the degree of the vertex removed. The best and worst are nine hundred times apart.

So a Laplacian solve has a preliminary step that a nonsingular solve does not, and there are three standard ways to take it. This essay measures all three against an answer computed a fourth way, and then measures the parameter that the most popular of them hides.

Three ways to make it invertible

Ground a vertex. Pick one, delete its row and column — the same construction every effective resistance in this field is computed through — solve the remaining (n − 1) × (n − 1) system, and set the deleted potential to zero. This is the electrical reading — earthing a node — and it is the standard move because it is free: the reduced matrix is symmetric positive definite for any connected graph, so a Cholesky factorisation applies directly.

Project. Solve on the subspace orthogonal to the kernel. In practice this means subtracting the mean from b before starting and from x afterwards, and running an iterative method that stays in the subspace because the matrix maps it to itself. Conjugate gradients does this without being asked.

Regularise. Solve (L + τ·11ᵀ/n)x = b instead, with b orthogonal to the ones. That rank-one addition moves the eigenvalue at zero to τ and leaves every other eigenvalue and eigenvector alone, so for b in the range of L the answer is the same one — and the matrix is positive definite, so again a Cholesky applies.

All three are exact in exact arithmetic and none is obviously better. The interesting question is what they cost in the arithmetic there actually is.

What happens if the step is skipped

Before comparing the three, it is worth asking what a solver does when handed the singular matrix directly, because the answer is not what a reader of the paragraph above would predict.

The site’s own pivoted elimination, given L and a right-hand side that sums to zero:

graph          smallest pivot   flagged singular   what solve returned
path 30           0                  yes             nothing — it refused
grid 6×7          6.7·10⁻¹⁶          no              a vector
cycle 24          6.7·10⁻¹⁶          no              a vector
star 30           8.7·10⁻¹⁵          no              a vector
preferential      1.2·10⁻¹⁴          no              a vector
complete 20       3.6·10⁻¹⁴          no              a vector

Eight of the nine graphs tried do not trip the singularity test, and the one that does is the path — the graph whose elimination happens to be exact, because every pivot along a path is a ratio of small integers and every one of them is representable. Everywhere else the last pivot is the accumulated rounding of a quantity that is mathematically zero, it comes out at 10⁻¹⁵ or so, it is not zero, and nothing stops.

What comes back is not garbage. On the grid the returned vector has a relative residual of 7.4·10⁻¹⁶, and after subtracting its mean it agrees with the pseudoinverse solution to 2.7·10⁻¹⁵ — it is a perfectly good point on the solution line. Which point is decided by what the last division by 6.7·10⁻¹⁶ did, and here it shifted the whole answer by a constant of 2.54.

So the failure mode is the one this site keeps finding: not a crash, not a warning, but an answer of the right shape whose arbitrary component was chosen by a rounding error. Two runs of the same program on two machines that round that last pivot differently return potentials differing by a constant, and every residual either of them reports is 10⁻¹⁶. Deciding that a zero has arrived is the essay about the test that did not fire, and this is that test failing on a matrix that is exactly singular by construction.

They agree, and the agreement is the uninteresting half

Against a fourth route — the pseudoinverse assembled from the eigendecomposition, summing over the n − 1 non-zero modes — the three routes give:

graph          grounding   regularising   conjugate gradients   κ⁺(L)
grid 6×7        2.7·10⁻¹⁵    4.4·10⁻¹⁵        3.6·10⁻¹⁵          38.0
preferential    5.6·10⁻¹⁵    5.6·10⁻¹⁵        7.7·10⁻¹⁵          31.9
path 30         4.0·10⁻¹⁴    6.3·10⁻¹⁴        4.0·10⁻¹⁴         364

Every route is at the rounding level, and the three are within a factor of two of each other on every graph. The forward errors track κ⁺(L) — the condition number of the matrix restricted to the subspace it is inverted on — exactly as the error identity says they should: the path has ten times the condition number and ten times the error.

That is a result and it is worth stating before the rest of the essay complicates it: the choice of how to remove the kernel does not, on these graphs, cost accuracy. A reader who takes only that away has taken away something true.

Grounding requires choosing a vertex, and no account of the method says which. In practice it is whichever index the code drops — the last one, or the first, or whichever the data structure makes convenient. It reads like a labelling convention.

It is a parameter, and on a graph with unequal degrees it is worth three orders of magnitude.

Grounding vertex v leaves the matrix L with row and column v deleted, and that matrix’s condition number depends on v. Measured over every choice, on the same graph:

graph          best κ    at degree   worst κ    at degree   spread
star 30          1.00        29        898           1        898×
preferential    88.2         17        926           2       10.5×
grid 6×7       114            4        341           2        3.0×
path 30        386            2       1407           1        3.6×
barbell 10     119           10        154           9        1.29×

The star’s entry is the one to hold on to. Grounding the hub of a thirty-vertex star leaves the identity matrix — every remaining vertex is joined to the ground and to nothing else, so the reduced Laplacian is diagonal with every entry 1, and its condition number is exactly 1. Grounding a leaf leaves a matrix with condition number 898. Two ways of solving the same system, one of which is perfectly conditioned and one of which is not, differing only in which index was deleted.

The pattern across the table is that a high-degree vertex is the better ground, and it has a reading rather than being a coincidence. Grounding fixes a potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph. Grounding a leaf fixes the potential of a vertex whose only connection is one edge, which constrains almost nothing, and the remaining system is left with a nearly-free direction.

The size of the effect is governed by how unequal the degrees are. On the barbell, where every vertex has degree nine or ten, the spread is 1.29 and the choice is genuinely irrelevant. On the star, where the degrees are 29 and 1, it is 898.

One system, 60 ways to remove its kernel, and 10.5× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the preferential 60: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 53, of degree 2, gives κ = 926.22; grounding vertex 3, of degree 17, gives 88.226 — a factor of 10.5 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.25811141710²10³degree of the grounded vertexcondition number of what is left88.23, the best choicea parameter nobody setsvertices tried60best κ88at degree17worst κ926at degree2spread10one row and column deletedand it matters which
Fig. 2 The same measurement on a preferential-attachment graph, where the degrees run from two to seventeen and the spread is a factor of ten.

What that does and does not cost

Three orders of condition number sounds like three orders of accuracy, and it is not, which is the part worth being careful about.

The forward error of a backward-stable solve is bounded by κ times the unit roundoff, so on the star the badly grounded system has a bound 898 times looser. Both bounds are around 10⁻¹⁶ times something small, so both solves return an answer good to thirteen or fourteen digits and nobody notices.

Where it does bite is an iterative solve. Conjugate gradients takes a number of steps that grows like the square root of the condition number, so a factor of 898 in κ is a factor of thirty in the iteration count — and unlike the accuracy, the cost is not sitting nineteen orders below anything anybody cares about. The rate the condition number predicts is the essay about that relationship; here the point is that a labelling convention has walked into it.

And it bites in a second place, which is where this field goes next. A tree preconditioner is scored by a combinatorial quantity, and the scoring assumes a particular grounding; two implementations that ground differently are comparing preconditioners for two different matrices.

The one place the three routes genuinely part company

Everything above says the three are equivalent, and on a consistent right-hand side they are. The right-hand side is not always consistent.

A Laplacian system is solvable only when b sums to zero — the injected currents have to balance. In theory they do. In practice b is assembled from measurements, or from a discretisation, or from a previous computation, and its sum is not zero but ε. Nothing in the setup guarantees otherwise, and nothing reports it.

Adding a component ε along the vector of ones to an otherwise exact right-hand side, and measuring each route’s answer against the pseudoinverse solution of the consistent part:

   ε         grounding      regularising    projecting
   0          2.7·10⁻¹⁵      4.4·10⁻¹⁵       3.6·10⁻¹⁵
  10⁻¹²       1.0·10⁻¹¹      4.4·10⁻¹⁵       3.4·10⁻¹⁵
  10⁻⁸        1.0·10⁻⁷       4.4·10⁻¹⁵       3.6·10⁻¹⁵
  10⁻⁴        1.0·10⁻³       4.2·10⁻¹⁵       3.5·10⁻¹⁵
  10⁻²        1.0·10⁻¹       4.4·10⁻¹⁵       3.5·10⁻¹⁵

Two of the columns do not move at all and one of them tracks ε, amplified by ten.

The reason is what each route does with the inconsistent part. Projecting removes it explicitly — the mean is subtracted before the iteration starts, so the component never enters. Regularising sends it into the direction the rank-one term owns, where it contributes a multiple of the constant vector that is removed when the answer is centred. Grounding does neither: the reduced system is nonsingular, so it has a unique solution for every right-hand side, including inconsistent ones, and it returns the exact answer to a problem in which the missing current was silently injected at the grounded vertex.

That is a defensible thing to do and it is not what anybody thinks they asked for. It is also invisible: the grounded solve’s residual on its own reduced system is 10⁻¹⁶, so every check the solver can run reports success. The inconsistency is a property of the data that only the full system knows about, and grounding is precisely the step that threw away the row that knew.

The practical rule is one line: if the right-hand side is not exactly balanced, balance it before grounding. Subtracting the mean costs one pass and removes the entire effect. What it does not do is tell anybody the data was inconsistent, which — given that the amplification is ten and the inconsistency is often a bug rather than a rounding — is the thing actually worth reporting.

Why the projection route can be exact

The projection route has a property the other two do not, and it comes straight from the exactness of the kernel.

The kernel of the combinatorial Laplacian is spanned by the vector of ones, and L annihilates it exactly: measured, ‖L·1‖∞ is 0, not 10⁻¹⁶. So the subspace the projection works on is known in advance, exactly, without computing anything. There is no eigenvector to estimate and no basis to orthogonalise, and the deflation cannot drift, because the direction being deflated is not an approximation to anything.

Compare that with the ordinary situation. Deflating a converged eigenvector from a Krylov space means deflating a vector known to 10⁻¹⁴, and the leak is at that level and compounds over the iteration. Here there is no leak of that kind at all.

And the normalised Laplacian does not have this. Its kernel is spanned by D^{1/2}·1, which costs n square roots to build and is not exact; measured on four graphs, ‖𝓛 D^{1/2}1‖∞ comes to between 2.2·10⁻¹⁶ and 3.8·10⁻¹⁵. Nothing in this essay’s measurements fails because of that — the numbers above are at the rounding level for both matrices — but the kind of statement has changed. For one matrix the deflation is structurally exact. For the other it holds to the rounding level, which is a claim about the arithmetic rather than about the algebra, and a claim about the arithmetic is one an iteration can wear away.

star 30: 30 vertices, 29 edges, and a matrix built from themThe star 30 laid out at its own second and third Laplacian eigenvectors, so the picture is the same object the measurements are about. The Laplacian L = D − A is built by subtraction of integers, so every row sums to exactly zero — measured at 0, not at the rounding level — and L·1 is the zero vector with no arithmetic error anywhere in it. Its 1 zero eigenvalue counts the connected components, which breadth-first search also puts at 1; the smallest non-zero eigenvalue is 1 and the largest computed zero is 1.21·10⁻¹⁶, a gap of 8.26·10¹⁵. The quadratic form xᵀLx is Σ over edges of (xᵢ − xⱼ)², which at the alternating vector is 60.the matrix, measuredvertices30edges29‖L·1‖∞0zero eigenvalues1components, by search1λ₂1laid out at its own eigenvectorsand the row sums are exactly zero
Fig. 3 The star: one vertex of degree twenty-nine and twenty-nine of degree one, which is the graph the grounding choice matters most on.

The regularisation is not a regularisation

The third route deserves a sentence, because it shares a name with a whole field on this site and is not the same thing.

Regularisation proper changes the answer. A Tikhonov parameter trades residual against solution norm, the answer moves as the parameter does, and choosing it is the computation rather than a preliminary to it. Nothing like that is happening here: adding τ·11ᵀ/n moves one eigenvalue from zero to τ and leaves the other n − 1 eigenpairs untouched, so for a right-hand side in the range of L — which is any b that sums to zero, and any physical b does — the solution is unchanged for every τ.

What τ does change is the conditioning. Setting it far below λ₂ makes the shifted matrix badly conditioned in a direction the answer does not live in; setting it near λmax makes the matrix well conditioned and does nothing else. The right choice is therefore somewhere in the middle of the spectrum and is not delicate, which is exactly what a parameter that does not affect the answer should look like.

That distinction — a parameter that moves the answer against one that moves only the arithmetic — is worth keeping, because it is the difference between a modelling decision and an implementation detail, and this field is about to spend three essays on a case where the two are confused.

What to take away

On these graphs the three routes are equivalent to fourteen digits. The choice is not an accuracy question and should not be presented as one.

Grounding has a hidden parameter and it is worth setting. Ground the highest-degree vertex. It costs one pass over the degree array, it never hurts, and on a graph whose degrees are unequal it buys between a factor of three and a factor of nine hundred in the conditioning — which becomes a factor of thirty in the iteration count of anything iterative.

The projection route is the only one whose correctness is structural rather than numerical, and only for the combinatorial Laplacian, whose kernel is exact. That is not a reason to prefer it; it is a reason to know which of the three is being run when an iteration is long.

At other settings

One system, 36 ways to remove its kernel, and 2.85× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the grid 6×6: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 5, of degree 2, gives κ = 275.34; grounding vertex 15, of degree 4, gives 96.565 — a factor of 2.851 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.23410²degree of the grounded vertexcondition number of what is left96.56, the best choicea parameter nobody setsvertices tried36best κ97at degree4worst κ275at degree2spread2.9one row and column deletedand it matters which
Fig. 4 A grid, whose degrees run from two to four and whose spread is a factor of three.
One system, 20 ways to remove its kernel, and 1.29× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the barbell 10: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 11, of degree 9, gives κ = 153.78; grounding vertex 10, of degree 10, gives 118.99 — a factor of 1.292 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.91010²degree of the grounded vertexcondition number of what is left119, the best choicea parameter nobody setsvertices tried20best κ119at degree10worst κ154at degree9spread1.3one row and column deletedand it matters which
Fig. 5 A barbell, where every degree is nine or ten and the choice does not matter.
One system, 30 ways to remove its kernel, and 3.65× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the path 30: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 0, of degree 1, gives κ = 1407.1; grounding vertex 14, of degree 2, gives 385.82 — a factor of 3.647 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.1210³degree of the grounded vertexcondition number of what is left385.8, the best choicea parameter nobody setsvertices tried30best κ386at degree2worst κ1407at degree1spread3.6one row and column deletedand it matters which
Fig. 6 A path, the worst-conditioned graph here, where the spread is small and the conditioning is not.
One system, 60 ways to remove its kernel, and 2.35× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the two blocks 60: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 6, of degree 10, gives κ = 166.79; grounding vertex 35, of degree 22, gives 70.974 — a factor of 2.35 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.1012141618202210²degree of the grounded vertexcondition number of what is left70.97, the best choicea parameter nobody setsvertices tried60best κ71at degree22worst κ167at degree10spread2.4one row and column deletedand it matters which
Fig. 7 Two blocks, where the degrees are similar and the spread is correspondingly narrow.
path 30: 30 vertices, 29 edges, and a matrix built from themThe path 30 laid out at its own second and third Laplacian eigenvectors, so the picture is the same object the measurements are about. The Laplacian L = D − A is built by subtraction of integers, so every row sums to exactly zero — measured at 0, not at the rounding level — and L·1 is the zero vector with no arithmetic error anywhere in it. Its 1 zero eigenvalue counts the connected components, which breadth-first search also puts at 1; the smallest non-zero eigenvalue is 0.01096 and the largest computed zero is 9.65·10⁻¹⁷, a gap of 1.14·10¹⁴. The quadratic form xᵀLx is Σ over edges of (xᵢ − xⱼ)², which at the alternating vector is 116.the matrix, measuredvertices30edges29‖L·1‖∞0zero eigenvalues1components, by search1λ₂0.011laid out at its own eigenvectorsand the row sums are exactly zero
Fig. 8 The path, whose conditioning comes from its length rather than from its degrees.
Twenty eigenvalues, one of them zero, and the graph has one pieceThe Laplacian spectrum of two ten-vertex paths joined by a single edge of conductance 1, plotted on a logarithmic axis so the zero end is visible. The dashed line is the threshold 10⁻¹⁰‖L‖ = 1.06·10⁻⁹, and the number of eigenvalues below it is the spectral count of connected components: 1. Breadth-first search, which performs no arithmetic on any weight, says 1. The largest computed zero is 5.81·10⁻¹⁷ and the smallest eigenvalue above the threshold is 0.02462. A count of components is therefore a rank decision at a threshold, and the bridge's conductance decides which side of it λ₂ falls on — at nine orders above the rounding level, not at it.13579111315171910⁻¹⁹10⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹indexeigenvalue of L10⁻¹⁰‖L‖, the thresholda count that is a thresholdeigenvalues below it1components, by search1largest computed zero5.8·10⁻¹⁷smallest above it0.025ratio4.2·10¹⁴the graph is connectedat every stop of the slider
Fig. 9 The spectrum whose zero the whole essay is about removing.
The lower bound is attained and the upper one is out by 37.3×Cheeger's inequality on nine graphs of about 40 vertices each: for the normalised Laplacian's λ₂, λ₂/2 ≤ φ ≤ √(2λ₂), where φ is the conductance the sweep cut actually achieves. Each row shows the two bounds as a bar and the measured conductance as a dot inside it. The lower bound is tight on the complete at a ratio of 1. The upper bound is loosest on the barbell — by a factor of 37.3 — which is the graph in the census with a real bottleneck, and therefore the shape the inequality is always quoted about. The square root is what makes it loose: it is the price of turning a spectral quantity into a combinatorial guarantee, and it is paid where the guarantee is wanted.10⁻³10⁻²10⁻¹110¹12345678910conductance, and the two bounds on itpathcyclegridbarbelltwo blockshypercubepreferentialstarcompletethe bar is the inequalitythe dot is the graph
Fig. 10 The bounds on the smallest non-zero eigenvalue, which is what κ⁺ is one over.
Conjugate gradients at κ = 104, against the bound κ permitsA semi-logarithmic plot of the relative A-norm error against iteration count. The measured curve falls below a smooth dashed curve showing the classical condition-number bound.0408012016020024010⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹iteration‖e‖_A / ‖e₀‖_Ameasuredκ bound119 steps40×40, spectrum spread evenly in logbound permits 1417
Fig. 11 An iteration whose step count is the square root of the condition number this essay moves.
The condition number a sketched preconditioner leaves, against the condition number it was givenTwo curves against κ(A), both axes logarithmic. The matrix's own condition number climbs the diagonal from 100 to 10¹⁰; κ(AR⁻¹), where R comes from a QR of a 4n-row sketch, is 2.2284 at every one of them — the same number to ten digits, not a similar one. The reason is two lines of algebra: with G = SU the preconditioned singular values are those of (GᵀG)⁻¹, which has no spectrum of A in it at all.10²10⁴10⁶10⁸10¹⁰110²10⁴10⁶10⁸10¹⁰condition number of the matrixcondition number seen by the iterationκ(A), unchangedκ(AR⁻¹)a bound with no κ(A) in itκ(AR⁻¹), every κ(A)2.2κ(SU), the other route2.2κ(A), across the sweep10⁸κ(AR⁻¹), across the sweep1the sketch never sees the spectrumand the spectrum cancels out of the answer
Fig. 12 Changing a condition number on purpose, in the field that does it for a living.
LSQR steps to a normal residual of 10⁻¹², with and without a sketched preconditionerTwo curves against κ(A). The unpreconditioned solve takes 15, 22, 32, 59, 150 steps as the conditioning worsens, and at the worst one it does not reach the tolerance inside 150. The preconditioned solve takes 10, 10, 10, 10, 10 — flat across eight decades. Both return the same vector, to the accuracy the problem allows: the preconditioned answer and the direct one differ by about κ(A)·u at every κ, 5.7·10⁻⁶ at the worst. The SAME sketch used as an answer instead of as a preconditioner is 4.5 away.10²10⁴10⁶10⁸10¹⁰110¹10²10³condition number of the matrixLSQR steps to 10⁻¹²no preconditionersketchedthe cost, not the answersteps, preconditioned10steps, without150answer gap, preconditioned5.7·10⁻⁶κ(A)·u at the worst κ1.1·10⁻⁶answer gap, sketch-and-solve4.5one sketch, two things to do with itand only one of them moves the answer
Fig. 13 And what that buys in iterations, which is where the grounding choice is felt.
The exact solution of a 13×13 Hilbert system beside the computed oneTwo columns of numbers: the exact answer, which is the integers one to thirteen, and the answer double-precision elimination returns, with the number of correct digits beside each.H13 x = b, b formed exactly so that x = (1, 2, …, 13)12345678910111213exact1.00002.00003.00133.97865.18864.993010.46720.048921.2657-2.575319.21478.906013.5113computed6.6 correct digits4.8 correct digits3.4 correct digits2.3 correct digits1.4 correct digit0.8 correct digitno correct digitsno correct digitsno correct digitsno correct digitsno correct digits0.6 correct digit1.4 correct digitbackward error2.2·10⁻¹⁷κ = 1.7·10¹⁸The algorithm solved a neighbouring problem perfectly. That problem's answer is this one.right-hand side built in BigInt rationalsthe truth is known
Fig. 14 A solve measured against an answer that is known rather than estimated.
Backward and forward error against the condition numberA log–log plot over twelve decades of condition number. The backward error is a flat line at ten to the minus sixteen; the forward error rises in proportion to the condition number.110²10⁴10⁶10⁸10¹⁰10¹²10¹⁴10⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹condition number κ(A)relative errorforward errorbackward errorpredicted: κ · u8×8, 20 seeds per κ; dashed is the worstthe problem worsens, not the method
Fig. 15 The two errors, which the table of three routes reports the second of.
How much a perturbation of the right-hand side is amplified, κ = 10⁶The cumulative distribution of the amplification factor over two hundred random perturbation directions, with the condition number marked as the upper limit.110¹10²10³10⁴10⁵10⁶10⁷00.250.50.751amplification of the input perturbationfraction of directions at or belowκ = 10·10⁵worst found 7.6·10⁵6×6, 200 directionsmedian reaches 0.29 of κ
Fig. 16 The amplifier, which the grounding choice moves by nine hundred without touching the problem.
Backward error, forward error and the condition number, with measured valuesTwo boxes at the top — the problem posed and the nearby problem the algorithm answered exactly — and two answers below them, with the distances between all four labelled by numbers from a Hilbert solve.the problem you posedA = H10b = A·(1, 2, …, 10)the problem it answered exactlyA + δA, b + δb‖δ‖ / ‖A‖ = 2.3·10⁻¹⁷the answer you wantedx = (1, 2, …, 10), exactlythe answer you gotx̂, wrong by 2.7·10⁻⁴ relativebackward error 2.3·10⁻¹⁷forward error 2.7·10⁻⁴κ = 1.6·10¹³κ · η = 3.6·10⁻⁴, and the measured forward error is 2.7·10⁻⁴.The algorithm is not at fault. The problem is.H10, LU with partial pivotingresidual and error differ
Fig. 17 The identity the agreement of the three routes is read against.
Backward error with and without the structure, for Levinson and for elimination, n = 12Both solvers are backward stable on this family by the usual measure: the smallest perturbation of any kind that explains either answer stays below 3.1·10⁻¹⁷ at every ρ, and the two curves are indistinguishable. Insisting the perturbation be a symmetric Toeplitz matrix — the kind of object the problem was posed with — lifts both by orders, and at ρ = 0.999 Levinson's rises by a factor of 2.48·10⁶. Neither number is alarming in absolute terms; what is worth carrying is that the reassuring one is the one that is reported, and the two are not measuring the same thing.10⁻³10⁻²10⁻¹110⁻¹⁹10⁻¹⁷10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹1 − ρbackward errorLevinson, Toeplitzelimination, ToeplitzLevinson, any kindelimination, any kindat ρ = 0.999Levinson, any perturbation3.1·10⁻¹⁷Levinson, Toeplitz only7.6·10⁻¹¹the ratio between them2.5·10⁶diagonal defect of the first0.97the number that is reportedand the number that is asked about
Fig. 18 A backward error measured against a structure rather than against a matrix.
Past the cliff: what each method returnsLoss of orthogonality at four condition numbers past κ²u = 1. Cholesky QR returns a factor whose implied Q is 0.37 away from orthogonal at κ = 10⁸ and 1.49 at 10¹² — and at 3·10¹⁰ it refuses outright, on a pivot of -6.5·10⁻¹⁷. The sweep and the tree return a usable factorisation of every one of these matrices.‖QᵀQ − I‖ of the implied Qκ = 10⁸, Cholesky0.37κ = 10⁸, sweep8.5·10⁻⁹κ = 10¹⁰, Cholesky1.3κ = 10¹⁰, sweep3·10⁻⁷κ = 3·10¹⁰, Choleskyrefusedκ = 3·10¹⁰, sweep6.7·10⁻⁶κ = 10¹², Cholesky1.5κ = 10¹², sweep1.4·10⁻⁴the safe run is the one that failsrefusals in the range1wholly non-orthogonal returns2the pivot it refused on-6.5·10⁻¹⁷one of these outcomes is safeand it is the refusal
Fig. 19 What a singular system does to a solver that does not know it is singular.
How close Hager's estimate is to the true κ₁, over 200 seeded 8×8 matricesFive bars. The estimate is exactly the true condition number on 81% of the sample and inside ten per cent on 87%; the worst underestimate in the whole sample returns 38% of the truth. The last bar is the matrix built to defeat it, at 7.7%, well below anything the random sample reached.each bar is a percentage — of the sample, or of the true condition numberexactly right80.5%inside 10%87.0%inside a factor of 287.0%worst in the sample, ×10037.7%the constructed matrix, ×1007.7%usually exactexact share0.81worst of the sample0.38the constructed matrix0.077a routine that is right most of the timeand never wrong in the safe direction
Fig. 20 A condition estimate, and the spread of what it might have returned.
What two lines of scaling are worth: the same quadratic in nine systems of unitsThe forward error against the closed form for an overdamped chain of 8 masses, before and after Fan–Lin–Van Dooren scaling. The unscaled curve runs 7.49·10⁻¹⁴ to 0.001258 — every digit gone by the far end — and the scaled one runs 1.26·10⁻¹³ to 8.23·10⁻¹⁴, flat to within a factor of 2.01. The scaling is γ = √(‖K‖/‖M‖) and δ = 2/(‖K‖ + γ‖C‖), computed from three norms and nothing else, and the map back is λ = γμ with no rounding in the statement. Flatness is the half that matters: after scaling every stop of the sweep IS the same problem, so there is nothing left for the change of units to do.0246810⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹log₁₀ γ, the change of unitsforward erroras writtenafter scalingone change of variableunscaled, worst0.0013scaled, worst1.7·10⁻¹³orders recovered10scaled coefficient spread4.5the answer was never the problemthe units were
Fig. 21 A diagonal scaling recovering accuracy, which is what the normalised Laplacian is.
Two condition numbers of one 8×8 system, as its rows are put into different unitsFour curves against the spread of the row units, in decades. κ_∞ of the scaled matrix rises from 9.83 to 1.9·10¹⁰ while the componentwise condition number stays at 6.98 throughout — the same system, the same solution, and one of the two numbers is a fact about the units. Hilbert's two numbers are drawn flat beside them at 3.4·10¹⁰ and 1.2·10¹⁰: a matrix whose sensitivity no scaling repairs.0246810110²10⁴10⁶10⁸10¹⁰10¹²spread of the row units (decades)condition numberκ_∞(DA)cond(DA)Hilbert κ_∞Hilbert condone system, two numbersκ_∞ at no spread9.8κ_∞ at 10 decades1.9·10¹⁰cond, either end7Hilbert, equilibrated1.3·10¹⁰the solution is the same at every spreadand one of these curves knows it
Fig. 22 Condition numbers that move with the units, which a grounding choice is a discrete version of.
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. 23 Orthogonality lost in a Krylov space, which is the leak an exact deflation does not have.
What the solver reported, and what it achievedFinal relative residual and final relative error against the working precision, on a logarithmic vertical axis. The residual sits at the stopping tolerance at every precision — the method converged, by every test available to it. The error runs from 1.4·10⁻¹³ at 53 bits to 0.00597 at 8, tracking the unit roundoff, which is drawn beside it.614223038465410⁻¹³10⁻¹⁰10⁻⁷10⁻⁴working significand bitsrelative sizeerrorresidualuthe gap the solver cannot seeerror ÷ residual at 24 bits1.5·10⁶error ÷ residual at 16 bits2.3·10⁷error ÷ residual at 8 bits2.4·10¹⁰every convergence test passesand the answer is wrong in proportion to u
Fig. 24 A residual that says nothing about the error, in the field about what a residual is worth.
The accuracy asked for, against the accuracy obtained, for two kernels on one partitionε is applied to each block against that block's own largest singular value; the error is then reported against the whole matrix's norm. The two are not the same number and the dashed diagonal is where they would be. For 1/r the obtained error is 29 times smaller than the tolerance asked for; for log r on the identical partition it is 13 times smaller. Both curves are straight and parallel to the diagonal, so the knob does what a knob should — a decade in buys a decade out — and neither of them sits on it. The factor is how much of the matrix's mass lives off the diagonal, which is a property of the kernel; it is not the number of blocks, which is 112 and would put the curves on the other side of the diagonal.10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³ε asked for, per block‖A − A_H‖ ⁄ ‖A‖ obtainedasked = obtainedlog r1 ⁄ rtwo numbers, not one1/r, obtained at 10⁻⁸3.4·10⁻¹⁰log r, obtained at 10⁻⁸7.8·10⁻¹⁰1/r, obtained ⁄ asked0.034log r, obtained ⁄ asked0.078blocks in the partition112the tolerance is per blockand the error is per matrix
Fig. 25 A tolerance asked for against one obtained, which every iterative route here is stopped by.
Forward error of a 6×6 Hilbert solve at eight precisionsA bar for each significand width from 12 to 53 bits showing the relative error in the computed solution, with the condition number times the unit roundoff marked as a prediction.κ = 1.5·10⁷ · the exact answer is (1, 2, …, 6)12 bits3.316 bits0.8620 bits4.324 bits0.09330 bits7.6·10⁻⁴36 bits6.2·10⁻⁶43 bits2·10⁻⁷53 bits4.5·10⁻¹¹dashed: κ · unit roundoffone matrix, eight arithmeticsmeasured against a known answer
Fig. 26 The mantissa on a slider, on a solve rather than on a graph.
QᵀQ from classical Gram–Schmidt and from Householder on the 8×8 Hilbert matrixTwo eight-by-eight tables of QᵀQ. The upper one has ones on the diagonal and entries as large as one off it; the lower one is the identity to three decimal places everywhere.A = H8 · κ = 1.5·10¹⁰ · both factorisations reconstruct A to 6·10⁻¹⁷the diagonal is 1 in both — every column is a unit vector either way1.000000000001.000000000001.000000000001.000000000001.00000.002-0.002000001.0000.125-0.13300000.0020.1251.000-1.0000000-0.002-0.133-1.0001.000classical Gram–Schmidt1.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000Householderclassical ‖QᵀQ − I‖1.4Householder ‖QᵀQ − I‖1.4·10⁻¹⁵largest off-diagonal 1 against 3.1·10⁻¹⁶length is not angle
Fig. 27 A factorisation with its residual printed, which is the site’s rule.
Singular values of a rank-4 matrix with noise of relative size 10⁻⁸Ten singular values on a logarithmic axis. The first four sit near one; the rest sit at the noise level, and the vertical distance between the two groups is the evidence for the rank.1234567891010⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³1indexsingular valuecutoff, σ₁ · 10⁻¹⁰numerical rank 10gap 8.2·10⁶an opiniontrue rank 410×10, built with 4 nonzero valuesrank is a decision
Fig. 28 A threshold deciding an integer, which is the shape a component count also has.
Backward and forward error of two routes to x, on 30×30 systems across eight decades of κBoth routes start from the same LU factorisation. The LU solve's backward error is 2.2·10⁻¹⁷ at every conditioning — a flat line at the unit roundoff. Multiplying by the explicitly formed inverse gives 4.5·10⁻⁵ at κ = 10¹⁴, a slope of 0.94 against κ. The two forward errors, drawn above them, are 2.8·10⁻⁴ and 0.015 — within a factor of 54, which is why the difference between the two methods is invisible to anyone measuring how wrong the answer is.10²10⁴10⁶10⁸10¹⁰10¹²10¹⁴10⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³1κ₂(A)relative errorforward, A⁻¹bforward, A\bbackward, A⁻¹bbackward, A\bat κ = 10¹⁴η, LU solve2.2·10⁻¹⁷η, via the inverse4.5·10⁻⁵forward, LU solve2.8·10⁻⁴forward, via the inverse0.015one factorisation, two ways to use itand one of them forfeits the backward error
Fig. 29 Forming an inverse rather than solving, which the pseudoinverse route here does on purpose.
Growth factor under partial pivoting to n = 40: the bound, the worst case, and realityGrowth factor against matrix size on a logarithmic vertical axis. The two-to-the-n bound rises as a straight line; Wilkinson's matrix sits exactly on it; random matrices stay near one.0816243240110²10⁴10⁶10⁸10¹⁰10¹²10¹⁴matrix size ngrowth factor max|u| / max|a|the 2ⁿ⁻¹ boundworst of 30 randommedian randomWilkinson's matrix sits on the bound30 Gaussian matrices per sizeat n = 40: bound 5.5·10¹¹, worst 4.8
Fig. 30 A bound never attained, in the field that measured it first.
Classical and modified Gram–Schmidt: the same subtraction, in a different orderTwo panels of pseudocode differing in one argument, with the resulting pairwise dot products of the computed columns listed beneath each.for each previous column i, subtract the projection of column j onto qᵢclassicalr[i][j] = qᵢ · a[j] ↑ the ORIGINAL columnv = v − r[i][j] · qᵢthe three worst |qᵢ · qⱼ|:columns 7 and 8: 1columns 6 and 8: 0.13columns 6 and 7: 0.13modifiedr[i][j] = qᵢ · v ↑ what is LEFT of itv = v − r[i][j] · qᵢthe three worst |qᵢ · qⱼ|:columns 1 and 8: 4.4·10⁻⁷columns 2 and 8: 2.7·10⁻⁷columns 3 and 8: 2.4·10⁻⁸The two R factors agree to 1.2·10⁻⁶ relative. The two Q factors do not.the 8×8 Hilbert matrixone word, eight orders
Fig. 31 Two orderings of one algebra, which the three routes here are a third instance of.

What links here

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

Reads more easily once this is understood

Essays that name this one as worth reading first.

Named objects

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

ConditioningDeflationGraph laplacianGroundingNormalised laplacianNull spacePseudoinverseRegularisation