Iterating, instead of factorising

An operator with no entries

At the sizes where linear algebra is expensive the matrix does not exist. What exists is a subroutine that returns Av. Every Krylov method survives that unchanged; every algorithm that reads an entry disappears. And the derivative such a code computes is accurate to ten digits instead of sixteen, which turns out to cost nothing at all.

Worth reading first: The rate the condition number predicts · Changing the condition number on purpose · The direction the error leans.

Every method in this collection so far has been handed a matrix: an array of numbers it can index, compare, pivot on, scale, count the zeros of. At the sizes where linear algebra is genuinely expensive that array does not exist.

What exists is a subroutine. Give it a vector, it returns A times the vector. A finite element code assembles the product element by element and never assembles the matrix; a spectral method transforms, multiplies by a diagonal and transforms back; a Newton method differences its own residual; a kernel method evaluates a function of pairs of points. None of them can hand over an entry, and for most of them the entries would not fit if they could.

This essay is about what survives that, what does not, and about a derivative that is six orders of magnitude worse than the exact one and costs nothing.

Error of a difference quotient for J(x)v against ε, on the Bratu problem at n = 64The Jacobian of this problem is a formula, so the error of each quotient is measured against a derivative that is exact rather than against a better quotient. The forward difference falls with a slope of 1.01 — first order — reaches 1.28·10⁻¹⁰ at ε = 10^-6, and rises again with a slope of -1.00 as cancellation takes over. The central difference falls with a slope of 2.00 and bottoms at 1.11·10⁻¹² for two residual evaluations instead of one. Neither gets near the unit roundoff at any ε.10⁻¹⁷10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹10⁻⁷10⁻⁵10⁻³10⁻¹10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1εrelative error in J(x)vforwardcentralcancellationtruncationagainst a derivative that is exactforward floor1.3·10⁻¹⁰central floor1.1·10⁻¹²truncation slope, forward1truncation slope, central2no ε reaches the roundoffand the analytic derivative is free of the choice
Fig. 1 The error of a difference quotient for J(x)v against ε, measured against a Jacobian that is a formula. Truncation on the right, cancellation on the left, and a floor between them that no ε reaches past.

What survives, which is more than one expects

Every Krylov method, unchanged. Conjugate gradients, GMRES, LSQR, MINRES, Lanczos, Arnoldi — a Krylov method’s only interaction with A is the product Av. That is not an approximation to the statement; it is the whole interface. The site’s trace estimators are matrix-free, the Krylov exponential of the previous essay is matrix-free, and the Newton–Schulz iteration of the essay before it is matrix-free, and none of them was designed to be.

That last observation is worth pausing on. Three unrelated methods in this phase turned out to require nothing but products, and in each case it was a consequence of avoiding an expensive object rather than a design goal. Avoiding the object and avoiding the entries turn out to be the same discipline.

Relative error of e^Ab by Krylov against the number of matrix–vector products, n = 100The exponential of a 100×100 matrix is never formed: m products with A build a Krylov basis, the exponential of the m×m Hessenberg matrix is taken, and one combination of the basis vectors is the answer. The error falls superlinearly — 0.026, 8.4·10⁻⁴, 1.5·10⁻⁵, 1.6·10⁻⁷, 1.1·10⁻⁹ at m = 4, 6, 8, 10, 12 — and crosses the accuracy of the full dense exponential, drawn as the flat line at 3·10⁻¹⁶, at m = 18. That is 0.36 against 2.00 megaflops, on a dense matrix; on a sparse one the ratio is far larger.0481216202410⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹matrix–vector products, mrelative error in e^Abforming e^A: 3·10⁻¹⁶crosses at m = 18the vector, not the matrixsteps to the dense answer18dimension100Krylov megaflops0.36dense megaflops2the exponential that is computedis 18×18
Fig. 2 One of the three. A matrix exponential applied to a vector, computed from products alone, at a fifth of the arithmetic of forming the exponential.
Conjugate gradients at κ = 103, 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κ bound85 steps40×40, spectrum spread evenly in logbound permits 448
Fig. 3 And the oldest of them. Conjugate gradients has never needed an entry and the site has drawn it a dozen times without saying so.

What does not

Everything that reads an entry, and the list is longer than it looks.

Elimination, because there is nothing to compare when choosing a pivot. Cholesky, for the same reason. Equilibration and Skeel’s condition number, which need row norms. The growth factor. The sparsity pattern, and therefore every fill-reducing ordering. Every incomplete factorisation, which is defined by a pattern. Rank, which needs an SVD.

That is the whole of the site’s scaling field, its sparse-elimination field and its rank-revealing machinery, unavailable.

What is left for preconditioning is the difficulty, because a Krylov method without a preconditioner is not a solver at scale — it is a solver at the rate the conditioning allows, which is a rate the condition number predicts and is usually too slow.

CG iterations on the model problem, with the two preconditioners a matrix-free code can and cannot haveAt 400 unknowns, conjugate gradients takes 64 iterations unpreconditioned. Diagonal preconditioning — n probes, or the analytic diagonal, and therefore available without any entries — takes 64, which is the same number, because this operator's diagonal is constant and scaling by it is scaling by a scalar. An incomplete Cholesky takes 24, a factor of 2.67, and it is defined by the sparsity pattern: there is no way to ask a subroutine for it. That factor is the price of an operator with no entries.3613623633601020304050607080unknownsCG iterations to 10⁻¹⁰no preconditionerdiagonal (available)incomplete Choleskyat 400 unknownsunpreconditioned64diagonal64incomplete Cholesky24what the pattern buys2.7a Krylov method needs only productsand a preconditioner needs the entries
Fig. 4 What the entries buy, on the model problem: an incomplete Cholesky cuts conjugate gradients from 64 iterations to 24, and it needs the sparsity pattern. Diagonal preconditioning is available without any entries and buys nothing. Drag the grid.

The measurement, and the awkward direction of it

On the two-dimensional model problem at 400 unknowns:

preconditioner CG iterations available matrix-free?
none 64
diagonal 64 yes
incomplete Cholesky 24 no

The diagonal is available: n probes with unit vectors, or more usually the analytic diagonal, which most operators can supply. It buys nothing at all here — the diagonal of this operator is constant, so scaling by it is scaling by a scalar, and a Krylov method does not notice a scalar.

The one that helps by a factor of 2.7 is defined by the sparsity pattern.

And the ratio grows with the problem: 1.93 at 64 unknowns, 2.67 at 400. So matrix-free is not a fixed tax; it is a tax that increases with size — which is awkward, because the reason the entries are unavailable is usually that the problem is large.

Incomplete Cholesky on the 10×10 grid: κ 48.4 → 5.12A semi-logarithmic plot of relative residual against iteration for conjugate gradients with and without an incomplete Cholesky preconditioner, the preconditioned curve falling faster.051015202530354010⁻¹¹10⁻⁹10⁻⁷10⁻⁵10⁻³10⁻¹iteration‖r‖ / ‖b‖plain CGIC(0) CGwhat the preconditioner didκ(A)48κ(L⁻¹AL⁻ᵀ)5.1‖A − LLᵀ‖/‖A‖0.0832D Laplacian, n = 100√κ ratio predicts 3.07×
Fig. 5 What a preconditioner does to the spectrum a method sees, which is the mechanism the table is measuring. The ones available matrix-free are the ones that can be described without reference to a pattern.
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. 6 And the same trade in the randomised field, where the preconditioner is built from a sketch and needs only products — one of the few that is genuinely available here.

The derivative that is only half accurate

The commonest matrix-free operator in nonlinear work is a difference quotient. A Newton method needs J(x)v and can get it without ever forming J:

J(x)v  ≈  ( F(x + εv) − F(x) ) / ε

one extra residual evaluation. Its error has two parts that pull opposite ways: truncation, which is proportional to ε, and cancellation in the subtraction, which is proportional to u/ε. So there is a floor, at ε around √u, and no choice of ε gets below it.

Measured on the Bratu problem — chosen because its Jacobian is a formula, so the quotient is compared against a derivative that is a theorem rather than against a better quotient:

forward difference:  floor 1.3·10⁻¹⁰ at ε = 10⁻⁶,  truncation slope 1.01,  cancellation slope −1.00
central difference:  floor 1.1·10⁻¹²  at ε = 10⁻⁴,  truncation slope 2.00

Both slopes are the theory, fitted rather than asserted. And the floor is six orders of magnitude above the analytic derivative, which is exact.

Error of a difference quotient for J(x)v against ε, on the Bratu problem at n = 200The Jacobian of this problem is a formula, so the error of each quotient is measured against a derivative that is exact rather than against a better quotient. The forward difference falls with a slope of 1.00 — first order — reaches 2.24·10⁻¹¹ at ε = 10^-5, and rises again with a slope of -1.00 as cancellation takes over. The central difference falls with a slope of 1.84 and bottoms at 1.9·10⁻¹³ for two residual evaluations instead of one. Neither gets near the unit roundoff at any ε.10⁻¹⁷10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹10⁻⁷10⁻⁵10⁻³10⁻¹10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1εrelative error in J(x)vforwardcentralcancellationtruncationagainst a derivative that is exactforward floor2.2·10⁻¹¹central floor1.9·10⁻¹³truncation slope, forward1truncation slope, central1.8no ε reaches the roundoffand the analytic derivative is free of the choice
Fig. 7 The same sweep on a finer grid, where the floor moves — because refining changes the ratio of ‖F‖ to ‖Jv‖ that the cancellation term is proportional to — and the three slopes do not.
Relative error of two algebraically identical expressions for (1 − cos x)/x², in binary32A log–log plot of relative error against x. The expression written as it reads loses accuracy as x falls and is eventually wrong in every digit; the rearranged form stays at rounding level.10⁻⁸10⁻⁶10⁻⁴10⁻²110⁻⁹10⁻⁶10⁻³1xrelative error of the computed value(1 − cos x)/x², as written2 sin²(x/2)/x²no digits left at allbinary32 throughoutone function, two spellings · zero below 3.5·10⁻⁴
Fig. 8 The left-hand half of the V, in its simplest form: a subtraction of two nearly equal numbers, exact in itself, ruined by the rounding of what went into it.

And it costs nothing

Here is the result this essay was written for, and it is the counterweight the whole phase needs.

Newton on the Bratu problem, with the analytic Jacobian and with the differenced one:

analytic:            8.00   5.199·10⁻²   3.014·10⁻⁶   5.17·10⁻¹³   4.50·10⁻¹³
differenced, 10⁻⁶:   8.00   5.199·10⁻²   3.010·10⁻⁶   4.59·10⁻¹³   3.87·10⁻¹³
differenced, 10⁻⁸:   8.00   5.199·10⁻²   3.014·10⁻⁶   5.09·10⁻¹³   5.46·10⁻¹³

The same sequence to three digits, and the same final residual. A Jacobian wrong in the tenth decimal place produces a Newton method indistinguishable from one with an exact derivative.

The reason is worth stating exactly, because it is a general principle and not a fact about this problem. The derivative appears only in the step, and the residual is evaluated exactly. An error in J moves where the next iterate goes; it does not move where the fixed point is, because the fixed point is defined by F(x) = 0 and F is computed to full precision. A wrong derivative costs iterations and buys nothing in error.

At the crudest step size on the slider — ε = 10⁻², where the Jacobian is wrong in the fourth digit — the entire cost is two extra iterations. From 10⁻⁴ down it is none.

Newton on the Bratu problem: analytic Jacobian, differenced Jacobian at ε = 10^-6, and matrix-freeThree residual sequences, all starting from zero. The analytic Jacobian gives 8, 0.052, 3·10⁻⁶, 5.2·10⁻¹³; a Jacobian differenced at ε = 10^-6, whose entries are correct to about 1.3·10⁻¹⁰, gives 8, 0.052, 3·10⁻⁶, 4.6·10⁻¹³. They stop at the same residual. The matrix-free run, where GMRES sees only a closure and no entry exists anywhere, lands 8.1·10⁻¹⁶ from the analytic answer in 438 products.0123456710⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1Newton step‖F(x)‖analytic Jdifferenced Jmatrix-freeone fixed point, three derivativesanalytic floor4.2·10⁻¹³differenced floor3.9·10⁻¹³matrix-free floor3.8·10⁻¹³products used, matrix-free438the derivative chooses the stepand the residual decides the answer
Fig. 9 The three sequences: analytic, differenced, and fully matrix-free with GMRES seeing only a closure. Drag the differencing step across eight orders of magnitude and watch the answer not move.

The fully matrix-free version

The differenced Jacobian above was assembled column by column, so that the only difference between the two runs was the derivative. A real code does not assemble it. It hands the quotient to GMRES as a closure and never builds anything:

op.apply = (v) => (F(x + εv) − F(x)) / ε

Jacobian-free Newton–Krylov. On the same problem it lands 1.4·10⁻¹⁵ from the analytic Newton answer, in 448 products, with no array of numbers existing anywhere in the computation.

That number — 448 products for eight Newton steps — is where the cost has gone. It is the preconditioning problem from the top of this essay, arriving in its usual form: the inner Krylov solve needs more iterations than it would with a preconditioner nobody can build.

Two Krylov methods against products with A, at a kernel shift of 1Two error curves against the number of products with A, on a logarithmic vertical axis. The Arnoldi method reaches 0.1532 after 4 products and is 9.18 by the end of the run. The bidiagonal method reaches 0.1367 after 42 and degrades far more slowly.16111621263136414651566110⁻¹110¹products with Arelative errorArnoldi's best: 4Arnoldibidiagonalwhat a step buysArnoldi's best0.15products to reach it4bidiagonal's best0.14products to reach it42a tenth of the work to the same answerand no time at all spent there
Fig. 10 And the inner solve’s own convergence, which is where the 448 comes from. Every product in it is a residual evaluation of the nonlinear problem.

Choosing ε, which is a scaling question

The difference quotient has one parameter and choosing it badly is the commonest defect in matrix-free code, so it is worth writing the rule down.

The error is roughly ε‖J″‖/2 + 2u‖F‖/(ε‖v‖), minimised at

ε  ≈  2√( u ‖F‖ / (‖v‖ ‖J″‖) )

and the practical version of that — the one in every JFNK implementation — replaces the unknown second derivative by a scale built from the current iterate:

ε  =  √u · (1 + ‖x‖) / ‖v‖

The (1 + ‖x‖) is the important part and it is what a naive implementation leaves out. A fixed ε = 10⁻⁷ is a relative perturbation of 10⁻⁷ only when x is of order one; on a problem whose solution is of order 10⁶ it is a relative perturbation of 10⁻¹³ and the quotient is pure cancellation, and on one of order 10⁻⁶ it is a relative perturbation of 10⁻¹ and the quotient is pure truncation.

That is the scaling argument the previous phase made about condition numbers, arriving in a place nobody expects it: a constant with units in it is a constant about the problem’s description, and a differencing step has the units of x.

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.0123456110²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 6 decades1.9·10⁶cond, either end7Hilbert, equilibrated1.3·10¹⁰the solution is the same at every spreadand one of these curves knows it
Fig. 11 The previous phase’s version of the same point. A number that carries the units of the problem is a statement about how the problem was written down, and a fixed ε is exactly such a number.
The spacing between consecutive numbers at 24-bit precisionA log–log staircase of the gap between neighbouring representable numbers against magnitude. The gap doubles at every power of two and reaches one whole unit partway along.110³10⁶10⁹10¹²10¹⁵10¹⁸10⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110³magnitude of the numbergap to the next representable numberat 1: 1.2·10⁻⁷at a million: 0.063gap reaches 1: 124-bit significandthe gap follows the magnitude
Fig. 12 And what a relative perturbation means in the format: the spacing of the representable numbers scales with their size, which is why the differencing step has to as well.

What a matrix-free code can still precondition with

Not nothing, and the list is worth having because it is the practical content of the whole essay.

Physics-based preconditioners. A simplified operator that can be assembled — a lower-order discretisation, a scalar diffusion in place of a tensor one, a linearisation about a simpler state. This is what most production matrix-free codes actually do.

Multigrid. A hierarchy needs a coarse operator, and the geometric version builds it from the grid rather than from the matrix. That is why geometric multigrid is the preconditioner of choice for matrix-free discretisations, and why the algebraic version — which builds the hierarchy from the matrix entries — is exactly the one that is unavailable.

Sketching. A randomised preconditioner is built from products with random vectors, which is precisely the available interface. It is one of the very few genuinely general options.

The diagonal, where it varies. Free here only because this operator’s diagonal is constant; on a variable-coefficient problem it is worth having and costs n probes.

Convergence factor against grid size, with 2 pre-smoothing sweepsThree curves against grid size on a logarithmic horizontal axis. Two rise towards one; the third is a flat line near a tenth.10¹10¹.³10¹.⁶10¹.⁹⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰¹10².²00.250.50.751grid points nresidual reduction per stepJacobiGauss–SeidelV-cycleV-cycle spread, 8× in size0.003Jacobi at n = 1270.99work exponent, fitted0.079the dashed curve is cos(πh), Jacobi's closed formthe flat line is the whole method
Fig. 13 The geometric hierarchy, which is available because it is built from the grid. The algebraic one is not, and the difference is exactly which object the coarse operator is derived from.
Sketch distortion against sketch width, for 60 vectorsA log-log plot of the worst relative change in vector length against the number of rows in the sketch, for vectors of two dimensions a factor of four apart. The two curves lie almost on top of one another and both fall steadily.10²10².³10².⁵⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁶10⁻¹10⁻⁰.⁵1rows in the sketchworst relative distortiondimension 64dimension 2565 seeds per point, band is best to worstthe dimension does not appear
Fig. 14 And the randomised route, whose whole interface is products with random vectors.

What this phase found, in one place

Eleven essays have replaced an object by an action: a determinant by an accumulated logarithm, an inverse by a pair of solves, an update by a refactorisation, an eigendecomposition by a polynomial in A, an n×n exponential by an m×m one, an SVD by an iteration, an n²×n² system by a back-substitution. In every case the substitute was better rather than merely cheaper.

This essay is the exception that gives the rule its shape, and it does so twice.

The substitution that costs nothing. A derivative six orders of magnitude worse than the exact one produces the identical answer, because the object it feeds into is not the object the answer is defined by.

The substitution that costs something structural. Giving up the entries costs no accuracy at all and costs a factor of 2.7 in iterations — and what was lost was not precision but every algorithm that needed to look. The tax is on the method library, not on the arithmetic.

So the phase’s sentence needs its second half. The object a question names is usually not the object worth computing; and where the substitution costs something, what it costs is access rather than accuracy.

log₁₀|det H_n| by three routes, to n = 30The exact rational determinant of the Hilbert matrix falls to 10^-518 at n = 30. The accumulated logarithm of the pivots follows it to n = 13 and then departs, reaching 10^-352 — wrong by 166 orders of magnitude and still an ordinary-looking number. The product of the pivots is a separate curve that ends at n = 29, where it underflows to exactly zero.26101418222630-550-450-350-250-150-50nlog₁₀|det H_n|exact rationalΣ log|u_ii|Π u_iithree routes, one theoremexact at the largest n-518accumulated logarithm-352decades of disagreement166smallest pivot at that n1.2·10⁻¹⁷every pivot is a normal numberat every size on this axis
Fig. 15 The first of the eleven, from the other end of the phase: an object that leaves the format while its substitute does not.
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. 16 And the second, where the substitution bought a bound on the backward error that the object could not provide.

Where the operators come from, and what each can supply

Matrix-free is one word covering four situations, and they differ in what they can be asked for besides a product. It is worth separating them, because the preconditioning question above has a different answer in each.

A discretised differential operator. A finite-element or finite-difference code applies the operator element by element or stencil by stencil. It can usually supply the diagonal cheaply — every element contributes to it — and it can supply a coarser version of itself, because the discretisation is parameterised by a mesh. That is why geometric multigrid is the preconditioner of choice here: the hierarchy comes from the modelling rather than from the matrix.

A transform-based operator. A spectral method applies A by transforming, multiplying by a diagonal, and transforming back. Its diagonal in the transform basis is explicit and its diagonal in the physical basis is not. Preconditioning is done in the transform basis, where the operator is diagonal and the problem is trivial — which is the whole reason to use one.

A differenced Jacobian. The case this essay measured. It can supply nothing but products, not even its own diagonal without n residual evaluations, and its products are accurate to about √u rather than u. It is the least informative operator of the four and the most common in nonlinear work.

A kernel or integral operator. A dense matrix that is never formed because it is n² entries of a smooth function. It can supply any entry on demand, which makes it the most informative of the four: hierarchical and low-rank methods work precisely because a block far from the diagonal is numerically low rank and can be sampled.

The list is worth having because it inverts the usual framing. Matrix-free is not a single loss of information; it is a spectrum, and the question for a given code is which of the entries it could supply if asked, and at what price. A differenced Jacobian’s diagonal costs n residual evaluations; a kernel’s costs nothing. The essay’s factor of 2.7 is the price of assuming the worst case when the answer might have been cheap.

Sketch distortion against sketch width, for 40 vectorsA log-log plot of the worst relative change in vector length against the number of rows in the sketch, for vectors of two dimensions a factor of four apart. The two curves lie almost on top of one another and both fall steadily.10²10².³10².⁵⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁹⁶10⁻¹10⁻⁰.⁵1rows in the sketchworst relative distortiondimension 64dimension 2565 seeds per point, band is best to worstthe dimension does not appear
Fig. 17 The one preconditioner whose interface is exactly the one every case above can supply: products with random vectors, and nothing else.

That reframing suggests a question worth asking of any matrix-free code before accepting the tax: what would it cost to build the sparsity pattern alone, without the values? For a finite-element operator that is the element connectivity, which the code already has; for a stencil it is the stencil. And a pattern without values is enough for a fill-reducing ordering, for a graph-based coarsening, and for the structure of an incomplete factorisation — leaving only the values to be filled in, at one probe per colour of a graph colouring rather than one per column. Probing a sparse operator for its entries costs the number of colours, not n, and on a stencil that is a small constant. The factor of 2.7 above is the price of never asking.

What is worth carrying

A Krylov method needs one thing from a matrix and it is not the entries. Everything built on products survives a matrix that does not exist; everything built on comparisons does not.

What is lost is the method library, and it costs iterations rather than digits. A factor of 2.7 on the model problem, growing with the size, because the preconditioner that works is defined by a pattern.

A differencing step has the units of x, so a fixed ε is a bug that only appears on problems scaled differently from the one it was tuned on. Scale it by (1 + ‖x‖)/‖v‖ and it is a relative perturbation everywhere.

And a derivative wrong in the tenth digit costs nothing, because it appears only in the step while the residual is evaluated exactly. The general form: a method whose answer is defined by a quantity it computes exactly can afford to be very wrong about everything else — and it is worth asking, of any approximation, which of those two roles it is playing.

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.

CancellationFinite differenceIncomplete factorisationJacobianKrylov subspaceMatrix-freeNewton iterationPreconditioningSparsity