The matrix a constraint makes

On a block with room, the residual was honest

Conjugate gradients stopped at a relative residual inside a block preconditioner had delivered energy errors ten to a billion times below its tolerance, and a stop on the estimated energy error changed almost nothing, because blocks of a dozen unknowns converge by orders at their last step. The prediction for a block of 400 unknowns with evenly spread eigenvalues was that the energy stop would land within a factor of three of its target and the residual stop at least ten times below. The energy stop does, on every draw. So does the residual stop, within a factor of five, in the same number of steps. On an even spectrum the residual is already an estimate of the energy error. A geometric spectrum is where the two part, and there the cheap energy estimate overshoots its target fourfold.

Worth reading first: A parameter that counts steps · Three eigenvalues, and two are the golden ratio.

A tolerance is not an accuracy put conjugate gradients inside the first block of a saddle-point preconditioner and found that a relative residual of τ\tau handed back energy errors ten to a billion times below τ\tau. The step was coarser than the test then stopped the same inner solve on Hestenes and Stiefel’s estimate of its energy error instead, so that each application would deliver close to its target, and found that it changed almost nothing: the step rule counted 154 of 198 outer runs within one rather than the 180 predicted, and on 82 of 132 runs both stops chose the same iterate. The reason was the size of the blocks. With a dozen unknowns, conjugate gradients’ error falls slowly and then by orders at the last step, as the Krylov space fills the whole of it, so any two stopping tests pick between the same two iterates.

That diagnosis made a prediction about blocks that do not run out of space. On a block of 400 unknowns with a condition number of 10410^4 and evenly spread eigenvalues, conjugate gradients converges at a steady rate long before the space fills, so there are many intermediate iterates to choose among. The prediction with a sign was that there the energy stop delivers within a factor of three of its target on nine runs in ten, while the residual stop delivers something further from it, by at least a factor of ten, on most.

The first half holds on every draw. The second does not hold on any, and the reason is a property of the spectrum the prediction chose.

The inner solve alone

The measurement here is the inner solve itself, without the outer iteration around it, because the claim is about what an inner solve delivers. A block is H=Q diag(λ) QTH = Q\,\mathrm{diag}(\lambda)\,Q^{\mathsf T} with QQ a random orthogonal matrix and λ\lambda either evenly spread from 1 to 10410^4 or geometrically spread over the same range, at 12, 50, 100 and 400 unknowns. Six random right-hand sides are solved on each. The exact solution is available from QQ and λ\lambda, so the relative energy error ∥x−x⋆∥H/∥x⋆∥H\|x - x^\star\|_H / \|x^\star\|_H of what each stop returns is known exactly. The residual stop halts when ∥r∥/∥b∥≤η\|r\|/\|b\| \le \eta. The energy stop halts when the estimate of the energy error of the iterate dd steps back falls to η\eta, and returns that iterate, with d=2d = 2 as in the earlier essay.

The relative energy error conjugate gradients delivers over the target it was stopped for, against the target, by the residual stop and the energy stop with two steps of look-ahead, on a block of 400 unknowns with evenly spread eigenvalues and a condition number of ten thousand, six right-hand sidesevenly spread eigenvalues: energy stop 1.01 to 1.32, 1.06 to 1.16, 0.95 to 1.14, 0.86 to 1.07, 0.87 to 1.09; residual stop 0.27 to 0.98, 0.21 to 0.85, 0.22 to 0.86, 0.19 to 0.79, 0.20 to 0.65, at targets of ten to the minus 2, 4, 6, 8 and 10.10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²10⁻¹10⁻⁰.⁵110⁰.⁵10¹target, as a relative errordelivered over the targetenergy stop, worstenergy stop, medianresidual stop, medianresidual stop, lowest400 unknowns · κ = 10⁴ · even spectrumone is on target
Fig. 1 The relative energy error delivered over the target, against the target, on a block of 400 unknowns: the energy stop’s median (blue) and worst (amber), and the residual stop’s median (red) and lowest (grey), over six right-hand sides. The dial sets the spectrum.

On the even spectrum the energy stop delivers between 0.86 and 1.32 times its target at every target from 10−210^{-2} to 10−1010^{-10}, on every right-hand side. That is the first half of the prediction, and it holds with room to spare: not nine in ten within a factor of three, but every draw within a third. The residual stop delivers between 0.19 and 0.98 of its target. Its median is 0.53 to 0.84. Not one draw at any target lands a decade below, and the worst is a factor of five.

The two stops also take the same work. At 10−610^{-6} the residual stop takes a median of 116 steps and the energy stop 116.5, its two look-ahead steps included; at 10−1010^{-10}, 144 and 144.5. A code that switched from one to the other on this block would see the same iteration count and an answer half a decade closer to its target, which is a difference a few steps of either would erase.

Why the residual was honest

The two tests agree because, on this spectrum, they measure nearly the same thing.

Along one run of conjugate gradients on a block of 400 unknowns, the relative energy error divided by the relative residual at every step, on each spectrumeven: 1.66, 5.61, 1.67, 0.86, 0.88, 0.73, 0.78 at every twenty-fifth step, over 156 steps; geometric: 0.53, 0.36, 0.31, 0.35, 0.30, 0.33, 0.37, 0.26, 0.42, 0.44, 0.29, 0.27, 0.30, 0.44, 0.40, 0.38, 0.43, 0.54, 0.34, 0.47, 0.23, 0.30, 0.43, 0.39, 0.34, 0.31, 0.28, 0.51, 0.39, 0.25, 0.31, 0.17, 0.24, 0.32, 0.46, 0.27, 0.43, 0.36, 0.57, 0.39, 0.23, 0.45, 0.41, 0.52 at every twenty-fifth step, over 1086 steps.0200400600800100010⁻¹10⁻⁰.⁵110⁰.⁵10¹10¹.⁵stepenergy error over residual, both relativeeven spectrumgeometric spectrumone right-hand side eachnear one: the residual is an energy test
Fig. 2 Along one run of conjugate gradients on a block of 400 unknowns, the relative energy error divided by the relative residual at every step, on the even spectrum (blue) and the geometric one (red).

On the even spectrum, the relative energy error divided by the relative residual starts near 1.7, rises to about five over the first thirty steps and then settles between 0.7 and 0.9 for the rest of the run. A relative residual of 10−610^{-6} therefore means a relative energy error of about 0.8⋅10−60.8 \cdot 10^{-6}, and a test on one is a test on the other to within the factor that ratio wanders by. The reason is how conjugate gradients spreads its error. On an evenly spread spectrum the iteration attacks the whole range of eigenvalues at a common rate, so its error keeps the same distribution across the eigenvectors as it falls, and the residual, which is the error weighted by HH, keeps a fixed proportion to the energy error, which is the error weighted by H1/2H^{1/2}.

The billion-fold gap the earlier essays found needed the opposite: an error distribution that changes abruptly from one step to the next, which is what a block of a dozen unknowns does when its Krylov space fills. The answer that arrives when the space runs out describes that step, at which conjugate gradients becomes a direct method, and at that step the residual and the error both collapse, but in different proportions.

Twelve unknowns is the special case

The relative energy error delivered over a target of ten to the minus six, against the size of the block, by each stop on each spectrum, median of six right-hand sideseven: residual stop 1e-7 at 12, 0.16 at 50, 0.29 at 100, 0.75 at 400; energy stop 1e-7 at 12, 0.54 at 50, 0.61 at 100, 1.00 at 400; geometric: residual stop 0.03 at 12, 0.29 at 50, 0.78 at 100, 0.43 at 400; energy stop 0.04 at 12, 0.83 at 50, 3.79 at 100, 4.12 at 400, floored at ten to the minus twelve.10¹10¹.⁵10²10².⁵10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1unknowns in the blockdelivered over the targetresidual stop, evenenergy stop, evenresidual stop, geometricenergy stop, geometricκ = 10⁴ · target 10⁻⁶ · floored at 10⁻¹²a dozen unknowns is a special case
Fig. 3 The relative energy error delivered over a target of 10−610^{-6} against the size of the block, by the residual stop and the energy stop on each spectrum, median of six right-hand sides, floored at 10−1210^{-12}.

The size of the block is the whole story of the earlier result. At 12 unknowns both stops deliver 10−710^{-7} of the target on the even spectrum: the run lasts twelve to fourteen steps, finite termination does the work, and whatever was asked for, the answer is exact to rounding. At 50 unknowns the residual stop delivers 0.16 of the target and the energy stop 0.54; at 100, 0.29 and 0.61; at 400, 0.75 and 1.00. The residual stop’s under-delivery is a small-block effect that fades as the block grows, and by 400 unknowns it is a factor of less than two.

So the earlier essays’ finding that “a tolerance is not an accuracy” was true of the blocks they measured, and its size, ten to a billion, was a property of their size. On a block with room the tolerance is close to the accuracy, on this spectrum, and the step rule that failed there would have no reason to fail for the error’s sake. What was not measured here is the outer iteration on these large blocks, and so whether the step rule written in the target recovers its 180 of 198; the cost of running flexible GMRES with inner solves of a hundred steps or more on a dense block of 400 put it out of reach of this measurement.

How a stopping test is usually read

The standard reading of a residual tolerance comes from the bound that relates the two errors. For a symmetric positive definite block, the relative energy error is at most κ\sqrt{\kappa} times the relative residual, and at least 1/κ1/\sqrt{\kappa} times it, so at κ=104\kappa = 10^4 a residual of 10−610^{-6} guarantees an energy error between 10−810^{-8} and 10−410^{-4}. That band is four decades wide, and a code that knows only the residual has to plan for either end of it. A stopping test is a race made the general point that a test reads one quantity and promises another. What these runs show is where in the band conjugate gradients actually sits: within a factor of five of the middle, on an even spectrum, and within a factor of three below it on a geometric one. Neither end of the band is approached. The bound is attained only by right-hand sides lying on single eigenvectors, and conjugate gradients on a random right-hand side spreads its error far too evenly to approach it.

That is also why a sharper test of the residual, of the kind the honest residual is not a stopping test discusses for the residual’s own rounding, changes nothing here: the targets here sit far above the rounding level, where the recurrence’s residual and the true one agree, and the question is only what the residual says about the error, which on these blocks is a constant factor.

A geometric spectrum parts them

The prediction chose an evenly spread spectrum. A geometric one, with the same condition number and the eigenvalues spread evenly in their logarithms, is the other common shape, and there the two stops do part, though not in the direction predicted.

Conjugate gradient steps taken by each stop against the target, on a block of 400 unknowns with each spectrum, median of six right-hand sides, the energy stop's two look-ahead steps includedeven: residual stop 75.5, 98.5, 116, 131, 144; energy stop 75, 99.5, 116.5, 131, 144.5; geometric: residual stop 240.5, 415.5, 584.5, 747.5, 910.5; energy stop 155, 333.5, 501, 676, 839.5 steps, at targets of ten to the minus 2 to ten to the minus 10.10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²02004006008001000target, as a relative errorstepsresidual stop, evenenergy stop, evenresidual stop, geometricenergy stop, geometric400 unknowns · κ = 10⁴even: the same steps; geometric: not
Fig. 4 Conjugate gradient steps taken by each stop against the target, on a block of 400 unknowns with each spectrum, median of six right-hand sides, the energy stop’s look-ahead included.

On the geometric spectrum conjugate gradients converges more slowly at first and the two stops take visibly different work. At 10−210^{-2} the residual stop takes 240 steps and the energy stop 155; at 10−610^{-6}, 585 and 501; at 10−1010^{-10}, 911 and 840. The ratio plot shows why: along the run the energy error is a third to a half of the relative residual, so the residual test is the stricter of the two and runs longer. The dial on the first figure shows what each delivers: the residual stop lands at 0.33 to 0.72 of the target, never under a third, and the energy stop lands at 2.9 to 4.8 times the target, above it on every draw at every target.

The energy stop overshoots because the estimate is a lower bound. Hestenes and Stiefel’s identity writes the energy error of an iterate as the sum of every later step’s contribution, and the estimate truncates that sum after dd terms. When the error falls by a large factor in each step, as at the end of a small block’s run, two terms are nearly all of it. When it falls slowly, as on a geometric spectrum’s long middle, two terms are a fraction of the sum, and the iterate returned has three or four times the error the estimate reported.

On a block of 400 unknowns with geometrically spread eigenvalues and a target of ten to the minus six, the energy error the energy stop delivers over the target for four lengths of look-ahead, with the residual stop beside itlook-ahead 1: 5.87 to 7.35 in 482 steps; look-ahead 2: 3.76 to 4.81 in 501 steps; look-ahead 4: 1.92 to 2.71 in 526 steps; look-ahead 8: 1.60 to 1.81 in 543 steps; residual stop 0.33 to 0.50 in 584.5 steps.0.10.31310energy stoplook-ahead of 1, 482 steps5.87 to 7.35look-ahead of 2, 501 steps3.76 to 4.81look-ahead of 4, 526 steps1.92 to 2.71look-ahead of 8, 543 steps1.60 to 1.81residual stoprelative residual, 584.5 steps0.33 to 0.50delivered energy error over the targetthe estimate is a lower boundlonger look-ahead, closer and dearer
Fig. 5 On a block of 400 unknowns with geometrically spread eigenvalues and a target of 10−610^{-6}, the energy error delivered over the target by the energy stop for four lengths of look-ahead, and by the residual stop.

Lengthening the look-ahead closes the gap at a cost. With one step the stop delivers 5.9 to 7.4 times the target in 482 steps; with two, 3.8 to 4.8 in 501; with four, 1.9 to 2.7 in 526; with eight, 1.6 to 1.8 in 543. The residual stop delivers 0.33 to 0.50 in 585. So on a slowly converging block, an energy stop that delivers within a factor of three needs a look-ahead of four or more, and one that delivers within a factor of two needs eight, which still saves forty steps over the residual stop and lands above the target where the residual stop lands below it. A code has to decide which side of its target it prefers to err on, and the residual stop’s side is the safe one.

Two spectra, two ratios

The ratio plot carries the whole comparison in one pair of curves, and the numbers along them are worth reading. On the even spectrum, after its first thirty steps, the ratio of relative energy error to relative residual sits at 0.87 at step 75, 0.90 at step 100, 0.72 at step 125 and 0.73 at step 150, the last before the run ends at a residual of 10−1210^{-12}: a factor that drifts by less than a fifth over five decades of convergence. On the geometric spectrum it is 0.53 at the first step and then wanders between 0.15 and 0.75 for a thousand steps, mostly near a third, never settling and never leaving that band. That run is seven times as long as the even one, 1,086 steps against 156, for the same condition number and the same final residual. Neither curve approaches the bound’s ends, κ=100\sqrt{\kappa} = 100 and 1/κ=0.011/\sqrt{\kappa} = 0.01.

What the geometric curve’s lower level means is that, on that spectrum, conjugate gradients removes the error along the large eigenvalues much faster than along the small ones, as the geometric spacing gives it many large eigenvalues well separated from one another to resolve early. What is left is concentrated at the bottom of the spectrum, where the residual weights it least, so the residual overstates the energy error by a factor of about three. On the even spectrum the eigenvalues are crowded uniformly and no part of the spectrum is resolved much ahead of the rest, so the proportion between the two norms holds. That is an account consistent with both curves rather than a measurement of where the error lies, which a code could make by projecting the error on the eigenvectors and which was not done here.

What this changes in the account

The earlier essays built a careful account of why stopping an inner solve on its residual wasted effort: the tolerance typed was not the accuracy delivered, and a stop written in the energy error would fix the mismatch. Measured on a block large enough to have a convergence rate, the account needs two corrections. On an evenly spread spectrum there is no mismatch to fix; the residual stop is within a factor of five of its target and costs the same steps as the energy stop. On a geometric spectrum there is a mismatch, but it runs the other way from the one the earlier account described: the residual stop over-delivers by a factor of two or three and runs ten to sixty per cent longer, and the energy stop, with the look-ahead used before, under-delivers by a factor of four.

None of this undoes the earlier findings on small blocks; it confines them. A square root the residual does not pay and where the augmentation puts the cost measured the outer iteration’s response to its inner accuracy, and that response is untouched. What changes is the expectation of how far the inner accuracy is from the number typed. The rate the condition number predicts is the setting in which a residual tracks an error: a steady rate on a spread spectrum. Small blocks have no steady rate, and that, not the residual, was what had made the tolerance mean so little.

What was measured

Every block is dense, symmetric and positive definite, with a random orthogonal eigenbasis and one of two spectra, and the right-hand sides are random. Right-hand sides concentrated on a few eigenvectors, as a saddle-point preconditioner’s inner solves often are, would change the error distribution and possibly the ratio between residual and energy error, and were not tried. The outer iteration was not run, for the cost stated above, so the effect on outer step counts is inferred from the inner accuracy rather than measured. Six right-hand sides at each setting give ranges rather than distributions. The energy estimate is the one the earlier essay used, without the adaptive look-ahead some codes use to make it tighter.

What is firm is the comparison on the inner solve: on 400 unknowns with an even spectrum both stops deliver within a factor of five of the target in the same steps; on a geometric spectrum the residual stop is safe and slower and the two-step energy stop is fast and four times over; and at a dozen unknowns both deliver far below any target because the run ends in finite termination.

Still open: the outer count on a large block, and right-hand sides with a shape

The step rule with room. With the inner solve now known to deliver within a factor of five of its target on an even spectrum, the prediction with a sign is that on saddle-point systems whose first block has 200 unknowns and an even spectrum of condition 10410^4, the step rule written in the target counts the outer steps of flexible GMRES within one on at least 90 per cent of runs, under either stop, so that the earlier rule’s shortfall was entirely a small-block effect; and that on a geometric spectrum it does so under the residual stop and falls short under the two-step energy stop, by the factor of four its delivered errors are off.

Right-hand sides from the outer iteration. The inner solves of a block preconditioner receive residuals of the outer iteration, not random vectors. The prediction is that those right-hand sides concentrate on the eigenvectors of the largest eigenvalues of the block, so that conjugate gradients removes them first and the ratio of energy error to residual falls below a tenth within the first few steps even on an even spectrum, bringing back an under-delivery by the residual stop of a decade, but not the billion-fold one of the small blocks.

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.

Block preconditionerCondition numberConjugate gradientsFinite terminationResidualSaddle-point systemsStopping criterion