The answer that depends on the machine

A floor the error has not reached

The residual a reduced-precision conjugate-gradient run stops on, recomputed in double, has a floor, and the floor can be predicted: on sixty runs of three problems it sits within a factor of 3.3 of a constant times u·‖|A||x|‖/‖b‖. The prediction was that the unit roundoff and the grid would be enough. They are not — adding the grid's size or κ(A) makes the prediction worse than u alone — and the quantity that works reads the solution. Nor is the floor a signal to stop. When the residual first comes within four times its own floor, the error is still a median 4.6 to 12.6 times its least, and on the slowest problem the least error arrives a median 76 steps later. A clause that stops there stops some run of every problem at three times its least error or more. What the floor can do is tell a run when to start checking often: switching to five-step checks within four times it keeps the error within a tenth of its least on both Laplacian problems and cuts the rate-set clause's overrun from 1,661 steps to 198.

Worth reading first: A stopping test is a race · Orthogonal is a number · The same program, twice.

Five steps is a rate found a stagnation clause that stops every reduced-precision conjugate-gradient run on three problems within two fifths of the least error the run reaches. It recomputes the residual in double, checks it at intervals set from the reduction it last saw, and stops when two checks in a row fail to halve it. Its price is the overrun: once a run is on its floor the clause’s last interval is long, and on the preconditioned Laplacian it ran 1,661 steps past the least error, summed over twenty runs, where a clause checking every five steps ran 198.

The essay located the fix in a number the run does not have. “A run on its floor has reached the error its precision allows, and the reading that never moves found that floor scaling with the working precision’s unit roundoff and the problem. If it were predictable from those two numbers, a clause could stop as soon as the double residual came within a small factor of it.” The prediction it signed was specific: the floor is predictable from the unit roundoff and the grid to within a factor of four on all three problems, and a clause stopping within that factor of it keeps the rate-set clause’s safety and runs no further past the least error than the fixed one.

Both halves fail, and the second fails for a reason the first sentence of that quotation already contained.

Sixty runs, and what their floors are

The runs are the earlier essay’s. The Laplacian on grids of 6, 8, 10, 12 and 14 points a side, at 24, 16, 11 and 8 bits of working precision, solved with an incomplete-Cholesky preconditioner, without one, and without one after scaling its rows and columns by a seeded diagonal spanning a decade and a half. Each run goes to a step cap with the residual recomputed in double, ∥b−Axk∥/∥b∥\|b - Ax_k\|/\|b\|, and the energy-norm error recorded at every step. The floor is the least double residual the run reaches. The reference solution is exact to double precision, so every error is measured rather than estimated.

The residual cannot fall below a floor for a reason that needs no theory of conjugate gradients. The iterate xkx_k is stored at the working precision, so each of its entries carries a relative rounding error of about u=2−bitsu = 2^{-\text{bits}}. Computing AxkAx_k in double from those rounded entries reproduces the error exactly: the residual of a vector rounded to uu is about uu times the size of the products that make up AxAx, and it cannot be smaller whatever the method did. The size of those products, entry by entry, is ∣A∣∣x∣|A||x|. So the natural prediction is u ∥∣A∣∣x∣∥/∥b∥u\,\| |A||x| \|/\|b\|, the same quantity a condition number scaling cannot move builds its componentwise measure from.

The floor the double residual of reduced-precision conjugate gradients reaches, against u·‖|A||x|‖/‖b‖, on sixty runs of three problemsFive grids from 6 by 6 to 14 by 14 at 24, 16, 11 and 8 bits, on the Laplacian with incomplete Cholesky, without a preconditioner, and scaled without one. The floor over the prediction runs from 0.60 to 6.39, a factor of 3.26 either side of 1.96. incomplete Cholesky: 0.60 to 1.17; no preconditioner: 0.77 to 1.66; scaled, no preconditioner: 1.22 to 6.39.sixty runsfloor ÷ prediction, least0.6floor ÷ prediction, most6.4factor either side3.310⁻⁸10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹10⁻⁸10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹u · ‖|A||x|‖ ÷ ‖b‖least double residual in the runincomplete Choleskyno preconditionerscaled, no preconditionerdashed: 1.96 times, and 3.26 either sidethe floor is the arithmetic's
Fig. 1 The least double residual of each run against u·‖|A||x|‖/‖b‖, sixty runs on three problems. The middle dashed line is the constant that centres them, the outer ones a factor of 3.26 either side.

It works. Across all sixty runs the floor over u ∥∣A∣∣x∣∥/∥b∥u\,\||A||x|\|/\|b\| lies between 0.60 and 6.39, which is a factor of 3.26 either side of 1.96. Inside each problem the band is narrower: 0.60 to 1.17 with the preconditioner, 0.77 to 1.66 without, 1.22 to 6.39 on the scaled problem, where the floor sits highest above the prediction. Seven decades of floor, from 10−710^{-7} at 24 bits to 10−210^{-2} at 8, follow the prediction’s line within that band.

The grid makes the prediction worse

That is within the factor of four the earlier essay asked for, but not from the two numbers it named. The quantity ∥∣A∣∣x∣∥/∥b∥\||A||x|\|/\|b\| reads the solution, and the prediction was meant to come from the unit roundoff and the grid. So the next measurement asks what the grid adds.

Five ways to predict the residual floor from the unit roundoff, and the factor either side of one constant each needs to cover all sixty runsu·κ(A): floor over prediction from 0.000469 to 0.268, a factor of 23.92 either side; u·n: floor over prediction from 0.00648 to 0.293, a factor of 6.73 either side; u alone: floor over prediction from 1.27 to 23.0, a factor of 4.25 either side; u·‖A‖‖x‖/‖b‖: floor over prediction from 0.0978 to 1.55, a factor of 3.98 either side; u·‖|A||x|‖/‖b‖: floor over prediction from 0.601 to 6.39, a factor of 3.26 either side. The prediction to be tested allowed a factor of four.u·κ(A)×23.92u·n×6.73u alone×4.25u·‖A‖‖x‖/‖b‖×3.98u·‖|A||x|‖/‖b‖×3.26×4bar: logarithm of the factor either sidethe grid makes it worse
Fig. 2 Five predictors of the floor, each u times something, and the factor either side of one constant each needs to cover all sixty floors. The dashed line is the factor of four the prediction allowed.

The unit roundoff alone needs a factor of 4.25 either side: the floor over uu runs from 1.27 to 22.95. Multiplying by the number of unknowns, the simplest way to put the grid in, makes it 6.73. Multiplying by κ(A)\kappa(A), which grows with the grid like its square, makes it 23.92. Only the two predictors that read the solution come inside four: u ∥A∥∥x∥/∥b∥u\,\|A\|\|x\|/\|b\| at 3.98 and the componentwise one at 3.26. The grid does not help because the floor does not follow it.

At 16 bits, the residual floor over the unit roundoff against the grid, on three problems, beside ‖|A||x|‖/‖b‖ for the Laplacianincomplete Cholesky: 6 by 6 2.3, 8 by 8 7.7, 10 by 10 5.8, 12 by 12 2.5, 14 by 14 1.5. no preconditioner: 6 by 6 1.9, 8 by 8 6.3, 10 by 10 10.3, 12 by 12 3.0, 14 by 14 2.5. scaled, no preconditioner: 6 by 6 4.8, 8 by 8 18.8, 10 by 10 19.3, 12 by 12 10.1, 14 by 14 7.7. ‖|A||x|‖/‖b‖ on the Laplacian: 6 by 6 2.13, 8 by 8 8.21, 10 by 10 7.61, 12 by 12 2.11, 14 by 14 1.75.across five grids, 16 bitsincomplete Cholesky: most ÷ least5.2no preconditioner: most ÷ least5.5scaled, no preconditioner: most ÷ least468101214110¹grid, k by kfloor ÷ uincomplete Choleskyno preconditionerscaled, no preconditioner‖|A||x|‖ ÷ ‖b‖dashed: the products' size, read off the solutionup at 8 and 10, down again
Fig. 3 At 16 bits, the floor over u against the grid on each problem, with ‖|A||x|‖/‖b‖ for the Laplacian dashed. The floor rises from 6 to 8 or 10 points a side and falls again.

At 16 bits the preconditioned run’s floor over uu is 2.3, 7.7, 5.8, 2.5 and 1.5 on the five grids in order: up by a factor of three and a third, then down by five. The unpreconditioned and scaled runs rise and fall in the same places. The dashed line is ∥∣A∣∣x∣∥/∥b∥\||A||x|\|/\|b\|, at 2.13, 8.21, 7.61, 2.11 and 1.75, and it rises and falls with them. The grid’s effect on the floor is real and enters entirely through the solution: the right-hand side here is bi=sin⁡(1+0.7i)b_i = \sin(1 + 0.7i), and how large a solution it produces relative to itself depends on how that sequence lines up with the grid’s low modes, which is not monotone in the grid’s size. A formula in nn or κ\kappa has nothing in it that rises at 8 and falls at 12. The earlier essay’s phrase “scales with the working precision’s unit roundoff and with the grid” was half right: the precision enters as uu and the grid enters as whatever the solution’s products happen to be on it.

This does not stop the floor being known before the run in practice. ∥∣A∣∣xk∣∥\||A||x_k|\| costs one product with ∣A∣|A|, and at any step the current iterate gives it to within the iterate’s error, which when the residual reaches its floor is at most a quarter of a per cent at 16 bits, 5 per cent at 11 and 31 per cent at 8 — and at 8 bits the prediction’s own band of 3.3 is the larger uncertainty. So the floor is available during the run, at the price of one extra product per check, and the measurements below use it that way.

The residual reaches its floor before the error reaches its least

With the floor in hand, the clause the earlier essay proposed is simple: stop at the first check where the double residual is within four times the predicted floor. It is unsafe, and the figure at the top of the page says why. It takes each run at the step where the double residual first comes within four times the run’s own floor — not the predicted one, the floor the run actually reaches, so no error in the prediction is involved — and reads the error there against the least the run ever reaches.

The error is not at its least. With the preconditioner it is 2.21 to 9.03 times the least, median 4.88; without one, 1.04 to 6.84, median 4.56; on the scaled problem 3.70 to 26.1, median 12.6. The least error comes later: a median 2 steps later with the preconditioner, 8 without, and 76 on the scaled problem, where the longest wait is 153 steps. So “a run on its floor has reached the error its precision allows” is false in the precise sense that matters. The residual is on its floor long before the error is, because the residual is bounded below by the rounding of xkx_k while the error goes on falling as the iteration keeps reducing the components of the error the residual weighs least. The reading that never moves and a small residual is not a small error are this site’s long record of the residual failing to report the error; this is the same failure in time rather than in size.

Conjugate gradients on the scaled 10 by 10 Laplacian at 16 bits: the double residual, the energy-norm error, the predicted floor, and where two floor-aware clauses stopThe predicted floor u·‖|A||x|‖/‖b‖ is 1.17·10⁻⁴ and the residual's least is 2.94·10⁻⁴, 2.52 times it. The residual first comes within four times its own floor at step 138, where the error is 8.15 times its least; the least error is at step 197. Stopping within four times the predicted floor stops at step 192, 1.02 times the least; switching to five-step checks there stops at step 202, 1.03 times; the rate-set clause at step 342, 1.05 times.scaled 10 × 10, 16 bitserror ÷ least, residual at floor8.2steps from floor to least error59predicted floor1.2·10⁻⁴05010015020025030035040010⁻⁴10⁻²1steprelative residual and errorresidual at its floorleast errorpredicted floorfour times itresidualerrorred: stop at the floor · purple: switch to five-step checksthe residual floors first
Fig. 4 One scaled run on the 10 by 10 grid: the double residual, the energy-norm error, the predicted floor and four times it, the step where the residual reaches its floor and the step of least error. The dots mark where the floor-stop and switching clauses stop. The dial sets the precision.

On the scaled 10 by 10 run at 16 bits the predicted floor is 1.17⋅10−41.17 \cdot 10^{-4} and the run’s own is 2.94⋅10−42.94 \cdot 10^{-4}, 2.5 times above. The residual comes within four times its floor at step 138, with the error 8.2 times its least, and the least arrives at step 197. Between them the residual is nearly flat and the error falls by most of a decade. At 24 bits the residual reaches its floor at step 200 with the error 17 times its least and the least at 247; at 8 bits, at step 26 with the error 8.3 times its least and the least at 107. The floor moves with uu, and the lag does not close.

How little the residual says between the two

The gap is not a matter of the residual being noisy near its floor and hiding a trend. Between the step it first comes within four times its floor and the step of least error, the residual’s largest value over its smallest is a median 2.71 with the preconditioner and never more than 3.99, while over the same steps the error falls by a median factor of 4.88. Without a preconditioner the residual’s range is a median 3.30 against the error’s fall of 4.56. On the scaled problem the residual moves by a median 5.50, with one run reaching 12.8 as the residual rises again after its least, while the error falls by 12.6. In every case the residual’s movement over those steps is of the same size as the factor of four that defined the start of the window, so it carries no more information about the error than the threshold itself did.

The reason is the one conjugate gradients always has for a residual that lags the error. The residual is AA times the error, so a component of the error along an eigenvector with a small eigenvalue appears in the residual multiplied by that small eigenvalue. Once the rounding of xkx_k sets a floor under the residual, the iteration can go on removing error along those directions and the residual has no room to show it. The scaled problem, whose condition number is the largest of the three, has the most of the error in such directions and waits longest. Buying the accuracy back made the complementary point for refinement: the residual computed in double is what lets a low-precision solve recover accuracy at all, and here it is also what sets the floor below which it can report nothing.

So a clause that stops near the floor is unsafe on every problem. Within four times the predicted floor it stops some run at 5.03 times its least error with the preconditioner, 3.46 without, and 5.01 on the scaled problem. Moving the threshold to twice the predicted floor brings those to 3.55, 2.99 and 1.56 — still over two fifths, and on the scaled problem only because the floor sits so far above the prediction that the residual rarely reaches twice it and the stall test ends most runs instead.

What the floor is for

The floor cannot say when the error has stopped falling. It can say when the residual is about to stop, and that is what the rate-set clause’s overrun was made of: a long interval set while the residual was falling fast, landing many steps past the point where it flattened. So the floor’s job is to shorten the interval, not to end the run. The switching clause runs the rate-set schedule while the residual is more than four times the predicted floor and checks every five steps once it is within it, keeping the stall test unchanged: stop when two checks in a row fail to halve the residual.

Four stopping clauses on three problems: the worst stopping error over the least in any run, and the steps run past the least, summed over twenty runsincomplete Cholesky: every five steps, worst 1.09, 198 steps past; rate-set, worst 1.09, 1661 steps past; stop within 4×, worst 5.03, 8 steps past; five-step within 4×, worst 1.09, 198 steps past. no preconditioner: every five steps, worst 1.10, 118 steps past; rate-set, worst 1.13, 1372 steps past; stop within 4×, worst 3.46, 3 steps past; five-step within 4×, worst 1.10, 123 steps past. scaled, no preconditioner: every five steps, worst 7.75·10⁵, 0 steps past; rate-set, worst 1.37, 1952 steps past; stop within 4×, worst 5.01, 500 steps past; five-step within 4×, worst 2.20, 546 steps past. Green: within two fifths of the least error on every run.every five stepsrate-setstop within 4×five-step within 4×incomplete Choleskyworst 1.09×198 steps pastworst 1.09×1661 steps pastworst 5.03×8 steps pastworst 1.09×198 steps pastno preconditionerworst 1.10×118 steps pastworst 1.13×1372 steps pastworst 3.46×3 steps pastworst 1.10×123 steps pastscaled, no preconditionerworst 7.75·10⁵×0 steps pastworst 1.37×1952 steps pastworst 5.01×500 steps pastworst 2.20×546 steps pasteach cell: worst error over the least, and steps past the least over twenty runsgreen: within two fifths of the leastthe floor says when to look
Fig. 5 Four clauses on three problems: the worst stopping error over the least in any run, and the steps run past the least summed over twenty runs. Green cells keep every run within two fifths of its least error.

On the two Laplacian problems it does what the earlier essay wanted. With the preconditioner its worst stop is 1.09 times the least error and its overrun 198 steps, exactly the fixed clause’s, against the rate-set clause’s 1,661. Without one, 1.10 and 123 steps, against the fixed clause’s 118 and the rate-set clause’s 1,372. It inherits the fixed clause’s speed where five steps are a fair test and the rate-set clause’s patience where the residual is still falling.

On the scaled problem it does not quite. Its worst stop is 2.20 times the least, against the rate-set clause’s 1.37, and its overrun 546 steps against 1,952. Five runs stop above one and a half times their least, every one of them before the least error rather than after it. This is the problem on which five steps do not halve the residual even while it is falling, which is why the fixed clause stopped all its runs by step 35 at up to 775,000 times their least. Near its floor the scaled run’s residual falls slowly enough that two five-step checks can fail to halve it while the error, 76 steps from its least in the median run, is still coming down.

On the scaled problem, the switching clause's threshold — how many times the predicted floor the residual must be within before checks go to every five steps — against its worst stop and its overrun2 times: worst 1.37 times the least, 1772 steps past it; 4 times: worst 2.20 times the least, 546 steps past it; 16 times: worst 5.94 times the least, 40 steps past it; 64 times: worst 42.33 times the least, 24 steps past it. The rate-set clause alone: worst 1.37, 1952 steps past.rate-set alone: 1952within 2×: steps past1772within 4×: steps past546within 16×: steps past40within 64×: steps past24110⁰.⁵10¹10¹.⁵10²threshold, times the predicted floorworst error ÷ least241664rate-set aloneswitching clausethe earlier the switch, the earlier the stopsafety costs the overrun back
Fig. 6 On the scaled problem, the threshold at which the switching clause goes to five-step checks, in multiples of the predicted floor, against its worst stopping error; the badge gives the overrun. The dashed line is the rate-set clause alone.

The threshold trades one for the other. At twice the predicted floor the switching clause is as safe as the rate-set clause, worst 1.37, and saves almost nothing, 1,772 steps past against 1,952, because the scaled runs’ floors sit above twice the prediction and the switch rarely happens. At four times it is 2.20 and 546; at sixteen, 5.94 and 40; at sixty-four, 42.3 and 24. There is no threshold that is safe and cheap on the scaled problem, because what the clause would need to know there is not where the residual will stop but whether the error has, and the residual cannot say.

What a code can take from this

The floor is the rounding of the iterate. u ∥∣A∣∣xk∣∥/∥b∥u\,\||A||x_k|\|/\|b\| predicts it within a factor of 3.3 either side of one constant on all sixty runs, at the cost of one product with ∣A∣|A|. A code reporting the double residual can report this beside it, and a reader seeing the two meet knows the residual has nothing further to say.

It is not a function of the grid. Formulas in the size or the condition number predict it worse than the unit roundoff alone, because the grid acts through the solution.

Reaching it is not converging. The error is a median 4.6 to 12.6 times its least when the residual gets there, and a clause that stops on it is unsafe on every problem measured. The honest residual is not a stopping test found that the double residual is the right thing to report and the wrong thing to stop on at the tolerance; it is also the wrong thing to stop on at its floor. A stopping test is a race found the bill for a run set by the moment a slowly falling residual crossed a line; near the floor the line is crossed slowly by construction, and the error is still moving when it is.

It is a good reason to look more often. Switching to five-step stall checks within four times the floor removes the rate-set clause’s overrun where five steps are a fair test and costs a factor of two on the problem where they are not. A tolerance that reads its own residual set an inner tolerance from the residuals it had seen and found the rule cheap and safe together; here the residual alone cannot be both, and the scaled problem is the case that shows it.

What sixty runs do not show

Three problems on one family of grids, one right-hand side, four precisions and one preconditioner, all symmetric positive definite and all small enough for an exact reference. The floor’s prediction uses ∣A∣∣x∣|A||x| at the solution; a code would use the iterate, and the difference near the floor is the iterate’s error, from a fraction of a per cent at 16 bits to 31 per cent at 8, at the stops measured here, which moves no conclusion. The error is the energy norm, the one conjugate gradients minimises; a different norm would change how far it is from its least when the residual reaches its floor but not, on these runs, whether it is. The precision is simulated by rounding every vector operation to a number of bits, not by a hardware format with its own exponent range, and at 8 bits the floor sits at about 10−210^{-2}, where the energy error’s least is not much below it.

Still open: what tells the error has stopped, and a stall in the middle

An error estimate from the method. Conjugate gradients carries the quantities for a cheap lower bound on the energy error — the sum of αj∥rj∥2\alpha_j\|r_j\|^2 over a window of the last dd steps. The prediction with a sign is that on the scaled problem a clause stopping when that estimate over a window of 20 steps falls below uu times the energy norm of xkx_k stops all twenty runs within two fifths of their least error, and does so within thirty steps of the least on the median run, where the rate-set clause runs 1,952 steps past it in total.

A stall in the middle. The earlier essay’s second question stands unanswered and is sharper now. A plateau partway down a run’s residual is a stall the floor cannot be blamed for, and the floor prediction makes it distinguishable from the end. The prediction is that on a problem built with a cluster of eigenvalues that conjugate gradients must resolve before the next decade, the rate-set clause stops on the plateau above twice its least error on some run, and the switching clause does not, because the plateau sits above four times the predicted floor and the switch never happens there.

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.

Condition numberMixed-precisionPreconditioningResidualStagnationStopping criterion conjugate gradientsUnit roundoff