Generator

pattern-buys

One function in the matfree library, called 16 times across 16 essays. Below: what it draws at its defaults, what it draws at every value an essay asks for, the 12 claims it put to the test while drawing them, and where it stands against the rule this site is named for.

At its defaults it draws cg iterations on the model problem, with the two preconditioners a matrix-free code can and cannot have. At 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.

pattern-buys is one function in lib/figures/matfree.js — matrix-free — what survives when the matrix is a subroutine, and what it costs. Everything below came out of it during this build, at arguments taken from the essays rather than invented for this page. A figure here is the figure a reader meets in an essay, and if the generator changes, this page changes with it.

At its defaults

Drawn even though every essay passes arguments — which on this site is every essay, at 100% of placements since the standard pass. A default nothing exercises is a trap for the next essay to call this with none, and this is the page where a default that has drifted from the figures around it becomes visible.

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

At 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.

kMax: 20

The arguments are the ones A direction the smoother cannot see passes. A value drawn at the generator's defaults instead would be a picture no essay asked for and no assertion has been run against.

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

At 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.

kMax: 16

The arguments are the ones A threshold between fill and growth passes. A value drawn at the generator's defaults instead would be a picture no essay asked for and no assertion has been run against.

CG iterations on the model problem, with the two preconditioners a matrix-free code can and cannot haveAt 256 unknowns, conjugate gradients takes 55 iterations unpreconditioned. Diagonal preconditioning — n probes, or the analytic diagonal, and therefore available without any entries — takes 55, 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 21, a factor of 2.62, 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.36861361862360102030405060unknownsCG iterations to 10⁻¹⁰no preconditionerdiagonal (available)incomplete Choleskyat 256 unknownsunpreconditioned55diagonal55incomplete Cholesky21what the pattern buys2.6a Krylov method needs only productsand a preconditioner needs the entries

At 256 unknowns, conjugate gradients takes 55 iterations unpreconditioned. Diagonal preconditioning — n probes, or the analytic diagonal, and therefore available without any entries — takes 55, 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 21, a factor of 2.62, 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.

What it checked while drawing

Every figure above asserted its own claims on the way to being drawn, and a claim that failed would have failed the build rather than drawn a wrong picture. Those assertions used to leave no trace at all: a passing one returned true and the only evidence the figure had checked anything was that nothing crashed. The list below is what they actually said, collected by running this generator with an observer installed — not a description of what it is believed to check.

12 distinct claims across 3 sets of arguments, grouped below by shape — because most of them are one sentence with a different number in it, and how many separate times that sentence was put to the test is the informative part.

at k = 6 diagonal preconditioning changes nothing, because the diagonal is constant — asserted 8 times

a grid the dense condition number can still be taken of

and the factor grows with the grid

by a factor approaching three at the largest grid

while an incomplete Cholesky cuts the count

Against the rule

The rule does not apply to it. It factorises nothing, so there is no residual it could be withholding. That is worth stating rather than leaving blank: a site that reported the rule as satisfied by every generator would be counting mostly generators the rule never reached.

Across the library: the rule bites on 92 of 198 generators — 77 print a residual and 15 are exempt with a published reason; 106 factorise nothing. Read from lib/residual-rule.js, which is the same body the gate enforces from, and the gate's last check fails the build if this page and it disagree about any generator.

Where it is called

Changing this generator changes every figure on this list. That is what makes the list worth publishing rather than keeping in a check script.

Iterating, instead of factorising

A direction the smoother cannot see

Give the Laplacian a strong direction and multigrid stops working — from 0.2016 a cycle to 0.9565 — with every component unchanged and the condition number identical to twelve digits. The problem did not get harder. The link between the method's two halves broke.

Iterating, instead of factorising

A hierarchy with no grid behind it

On a graph Laplacian the algebraic V-cycle converges at 0.199 a cycle, its grid complexity is an unremarkable 3.05, and its operator complexity is 17.7 — one level of forty-one unknowns is entirely dense. The number people quote is the one that does not measure the work.

Structure, and the solver that cannot see it

A preconditioner that changes sign

Strang's circulant preconditioner takes Toeplitz conjugate gradients from 179 steps to 10 at n = 256. At n = 64 on the same family it takes 66 steps to 109 — worse than doing nothing. Between those rows the preconditioner's smallest eigenvalue crosses zero, and nothing in the published account of the method mentions that it can be negative.

Sparsity, and what elimination costs

A threshold between fill and growth

One number decides how small a pivot an elimination will accept. At 0.001 the factor holds 172 entries and the matrix grows by 1,330; at 1 it holds 260 and grows by 1.2. The libraries ship 0.1, and the measurement says why.

Iterating, instead of factorising

Aggregating what the matrix calls strong

The depth phase measured every method it had on the 45°-rotated anisotropic operator — 0.784, 0.883, 0.844 — and diagnosed the failure as being in the discretisation rather than in the hierarchy. Smoothed aggregation is the standard answer to anisotropy. It returns 0.789.

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.

Iterating, instead of factorising

Changing the condition number on purpose

Preconditioning is usually introduced as a trick that makes an iteration converge faster. It is not a trick. It is solving a different system with the same solution and a condition number chosen rather than inherited, and the new condition number is computable.

Iterating, instead of factorising

Coarsening in one direction only

Leave the smoother alone and halve only the strong direction, and the smoothing factor is 0.3340 — identical to line relaxation's, at every anisotropy and every weight, to twelve digits. The convergence factors are then a factor of three apart, and at 45° both repairs fail outright.

Randomised, and the guarantee that changes kind

Randomisation does not create structure

On a matrix whose singular values are all equal, a rank-ten randomised approximation has error 1.0 — and so does the optimal deterministic one. Neither achieved anything, and only one of them is usually sold with the implication that it might.

Iterating, instead of factorising

Smoothing a whole line at once

Solve every grid line in the strong direction exactly rather than sweeping over it, and the smoothing factor goes from 0.9993 back to 0.3340 — which is the one-dimensional answer, on a problem that is not one-dimensional. The repair replaces one ε in the closed form by a one.

Sparsity, and what elimination costs

Structure and stability stop being separable

The sparsest variable to eliminate on this matrix has a diagonal entry of 10⁻¹². Eliminating it produces the smaller factor, reproduces the matrix to 3.8·10⁻¹⁷ — better than pivoting does — and returns an answer wrong in the fifth digit.

Iterating, instead of factorising

The coarse grid the matrix chooses

Given a tridiagonal matrix and no information about a grid, the coarsening keeps every other point and derives the weights ½, 1, ½ — the operators the geometric method was handed. Given the anisotropic operator, it discovers semi-coarsening, in the right direction, without a coordinate.

Randomised, and the guarantee that changes kind

The dimension does not appear

A random projection preserves the lengths of a set of vectors to within a distortion that depends on how many vectors there are and not on how many coordinates each one has. That is the fact the whole field rests on, and it is genuinely surprising.

Iterating, instead of factorising

The error smoothing cannot reach

One weighted Jacobi sweep multiplies every mode of the error by a number, and the number is a sine. Half the modes are cut by three or better, and the other half come back at 0.999 — which is not a failure of the method but the fact the whole of multigrid is built on.

Sparsity, and what elimination costs

The order decides the memory

Four elimination orderings on one matrix give factors of 1,739, 1,354, 1,413 and 1,026 entries. All four factorisations are exact, all four return the same answer, and the one with the better asymptotics is not the one that wins.

Iterating, instead of factorising

The rate the condition number predicts

Conjugate gradients converge at a rate governed by the square root of the condition number. That is a bound rather than an estimate, it is provable, and it is loose enough that provisioning iterations from it wastes nine out of ten.

The whole library · All essays · What must fail