Networks, and how a solve is checked

The step that returns the digits

A fifth-order ladder filter solved in double precision loses four decades in its stopband — 1.1 × 10⁻¹² of relative error at ten times the cutoff — on a solution vector that is right to round-off. One step of iterative refinement, in the same double precision, returns all of it: form the residual b − A·x, solve for a correction with the same elimination, add it, and every frequency is within 2.4 units of round-off of a 31-digit solve. The reason is that the plain solve is stable by the norm and not by the row — its componentwise backward error is 5.3 × 10⁻¹³ in the stopband rows — and one step makes it componentwise stable. The bridge walked to balance cannot be helped at all. Its node voltages are already right to the last bit; its digits are lost storing two numbers whose difference is the answer, and again storing its conductances, which moves the network itself by round-off over δ before anything is solved.

Assumes: The matrix that is ill, and the answer that is not · What a network answers, and how the answer is checked

Where the matrix is worst, and where the answer is not swept a ladder filter’s nodal matrix along the frequency axis and found its condition number predicting nothing. The solution vector was right to three units of round-off at every frequency; the response taken out of it lost four decades into the stopband, and the loss was predicted by one quantity that mentions no matrix: the round-off divided by the response. A small component of a well-solved vector, it concluded, is a small number carrying the absolute error of the large ones.

That is a diagnosis, and it invites a repair. The digits the arithmetic did not have applied the obvious one to a different network — more digits, a pair of doubles carrying 31 — and found it recovered the bridge’s lost digits completely. Thirty-one digits is the expensive cure, twenty times slower. There is a cheap one that numerical analysis has used since the first computers: solve, compute how wrong the answer is, solve for the correction, add it. Iterative refinement costs one matrix–vector product and one pair of triangular solves with a factorisation already in hand.

Applied to the ladder filter, one step of it in plain double precision returns every digit. Applied to the bridge, any number of steps returns nothing. The difference is a precise statement about where each network’s digits were lost.

One step of refinement in the same double precision returns the stopband's lost digits: 1.1e-12 at 10 kHz before, under 2.4 units of round-off aftercomputed by solving, not by drawing. The 5th-order Chebyshev ladder solved at every frequency in double precision (solid), and again after one step of iterative refinement — the residual b − A·x formed in double, the correction solved with the same elimination and added (dashed) — each against the same network eliminated in a pair of doubles. Plain, the response's error tracks the round-off divided by the response (dotted), from 1.1e-16 at 10 Hz to 1.1e-12 at 10 kHz, where the output is 6.78e-7 of the input. One step brings every frequency to within 2.4 units of round-off of the truth. No more digits were used: the loss belonged to the elimination's errors in the small component, and the residual, computed against the original matrix, sees them.101001k10kfrequencyrelative error of the response, against 31 digits10⁻¹⁶10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸solved once1.1e-12 at 10 kHzone refinement, in double2.4 round-offs at worstround-off ÷ responsethe plain solve's linesolved, then checked — against a 31-digit solvethe digits were in the residual
Fig. 1 The fifth-order Chebyshev ladder solved in double precision at every frequency (solid), and after one step of iterative refinement in the same double precision (dashed), each against the network eliminated in a pair of doubles. Plain, the error follows the round-off over the response (dotted) up to 1.1 × 10⁻¹² at 10 kHz. Refined once, it is within 2.4 units of round-off everywhere.

Solve, check, correct

The step is short to state. Having solved Ax=bA x = b for an approximate xx, compute the residual r=b−Axr = b - A x — how far the approximate solution is from satisfying the equations — then solve A d=rA\,d = r for a correction, using the elimination already done, and replace xx with x+dx + d. If the elimination were exact, dd would be exactly the error and the corrected xx exact. It is not, but the error in dd is a small fraction of dd, so each step multiplies the error by something small.

The classical form computes the residual in more precision than the solve, because the residual is a difference of nearly equal quantities — bb and AxA x agree to most of their digits by construction. The figure uses the opposite, cheaper form: the residual in plain double, the same precision as everything else. The comparison is against the same network eliminated from the start in a pair of doubles carrying 31 digits, which shares nothing with the double solve but the matrix.

Plainly solved, the filter’s response is right to a unit of round-off in the passband and loses accuracy as the response falls: 1.1×10−161.1\times10^{-16} at 10 Hz, 9.3×10−159.3\times10^{-15} at 3 kHz, 1.1×10−121.1\times10^{-12} at 10 kHz, where the output is 6.78×10−76.78\times10^{-7} of the input. That is the earlier essay’s finding, on the earlier essay’s line. One step of refinement brings every frequency to within 2.4 units of round-off. No extra digits were used anywhere.

One step, and the residual’s precision does not matter

The refinement converges in one step, and holding the residual in more digits buys nothing a double did not. computed by solving, not by drawing. The response's relative error against a 31-digit solve, after 0 to 4 steps of refinement, at 10 kHz with the residual in double (solid) and in a pair of doubles (dashed), and at 3 kHz in double (dotted). 10 kHz, double residual: 1.1e-12 → 0.0e+0 → 3.2e-16 → 3.1e-16 → 3.1e-16; 10 kHz, paired residual: 1.1e-12 → 0.0e+0 → 0.0e+0 → 0.0e+0 → 0.0e+0; 3 kHz, double residual: 9.3e-15 → 1.7e-16 → 4.3e-17 → 0.0e+0 → 0.0e+0. Errors of zero are drawn at 10⁻¹⁸. One step is all of it: the correction is computed against the original matrix with the same factorisation, and once the residual has been formed honestly the solve has nothing left to put right.
Fig. 2 The response’s relative error against the 31-digit solve after 0 to 4 refinement steps: at 10 kHz with the residual in double (solid) and in a pair of doubles (dashed), and at 3 kHz in double (dotted). 1.1 × 10⁻¹² → 0 → 3.2 × 10⁻¹⁶ in double; 1.1 × 10⁻¹² → 0 and stays there in a pair. Zeros are drawn at 10⁻¹⁸.

The refinement converges in one step. At 10 kHz the error goes from 1.1×10−121.1\times10^{-12} to exactly zero against the 31-digit answer after the first step, then sits at a few units of round-off on later steps as the correction itself rounds; at 3 kHz, 9.3×10−159.3\times10^{-15} to 1.7×10−161.7\times10^{-16}. Computing the residual in a pair of doubles changes the floor from a few units of round-off to zero and nothing else — it does not make the first step work any better, because the first step was not limited by the residual’s precision.

That is the opposite of what the textbook account of refinement would lead one to expect. Refinement in working precision is usually described as useless for accuracy, because a residual computed in the same precision as the solve is mostly round-off; what saves it here is that the problem was never the precision. The filter’s matrix is well conditioned enough — its condition number peaks at 1.59×1071.59\times10^{7} — that a correction solved from even a rough residual is accurate relative to itself, and the correction is small. The plain solve’s trouble was a particular kind of error in the elimination, and a single honest residual exposes it.

Stable by the norm, not by the row

The kind of error is the whole explanation, and it has a name.

Why one step is enough: the plain solve is normwise stable and componentwise not, and refinement in working precision is what makes it componentwise stable. computed by solving, not by drawing. For the fifth-order ladder filter: the normwise backward error of the plain solve, |b − A·x| over |A|·|x| + |b| in the largest component (dotted); its worst componentwise backward error, the same ratio row by row (solid); and the componentwise backward error after one refinement step in double (dashed). Normwise the solve is exact for data changed by 1.4e-18 — round-off — at every frequency. Componentwise it is exact only for data changed by up to 5.3e-13 at 10 kHz, in the rows the small stopband voltages live in. One step of refinement brings that to 9.8e-17, and a solve that is exact for every row's own data to round-off gives every component to round-off.
Fig. 3 For the fifth-order ladder filter: the normwise backward error of the plain solve (dotted), its worst componentwise backward error (solid), and the componentwise backward error after one refinement step in double (dashed). Normwise the solve is exact for data changed by 1.4 × 10⁻¹⁸ at every frequency; componentwise only for data changed by up to 5.3 × 10⁻¹³ at 10 kHz; refined, by 9.8 × 10⁻¹⁷.

A solve’s backward error is the smallest change to the data for which the computed answer would be exact. Measured the normal way — the size of the residual against the size of the whole matrix times the whole solution — the plain solve’s is 1.4×10−181.4\times10^{-18} at every frequency: it is exactly the answer to a problem changed by round-off. Gaussian elimination with pivoting is normwise backward stable, and the figure confirms it. But “changed by round-off” in the norm allows a change of round-off relative to the largest entry in every row, and in the stopband rows the entries that matter are small. Measured row by row, against each row’s own entries and solution components, the plain solve is exact only for data changed by 5.3×10−135.3\times10^{-13} at 10 kHz: the elimination has, in effect, perturbed the small stopband equations by an amount that is round-off for the input node and four decades more than round-off for the output.

A solve that is componentwise backward stable gives every component to round-off when the problem is well conditioned, small components included. One step of refinement in working precision makes Gaussian elimination componentwise backward stable — a result due to Skeel — and the dashed curve shows it happening: 9.8×10−179.8\times10^{-17} at every frequency after one step. The response’s digits were lost in the elimination’s rows, not in the matrix’s condition and not in the arithmetic’s width; the residual is computed against the original equations, row by row, and so it sees exactly the rows the elimination treated carelessly.

Why the condition number allowed it

The condition number was no use as a predictor of the stopband’s loss, and the earlier essay showed that at length. It is exactly the right quantity for the question refinement asks, which is whether a correction computed with the same flawed elimination is good enough to improve on what it corrects. Each step multiplies the error by roughly the condition number times the round-off, κε\kappa\varepsilon, and refinement converges whenever that is less than one. For this filter κ\kappa peaks at 1.59×1071.59\times10^7 at the band edge, so κε\kappa\varepsilon is 3.5×10−93.5\times10^{-9}: each step shrinks the error by eight decades, and one step is more than enough at every frequency.

That gives the condition number its proper job back. Where the matrix is worst, and where the answer is not found it overstating the solve’s error by many decades; here it bounds the rate at which the error can be removed, and the bound is loose in the safe direction. A network whose κ\kappa approached 101610^{16} — the feedback amplifier of the matrix that is ill, and the answer that is not, near the gain at which the solver refuses — would be one where refinement in double could not converge, because a correction would be as wrong as the thing it corrected.

The digits the arithmetic did not have reported the paired-double solve as twenty times slower than a plain one. One refinement step costs a matrix–vector product, of the order of the matrix’s number of entries, and two triangular solves with factors already in hand; for the filters here it adds a few per cent to the solve, and it recovers the same digits in the stopband that the twenty-fold slower route did. The expensive route is needed only where the cheap one cannot reach — which, by the next section, is where the digits were never in the solve.

Deeper stopbands, more to return

At ten times the cutoff the plain solve loses digits as the order deepens the stopband — 1e-10 at ninth — and one refinement step returns them all. computed by solving, not by drawing. The relative error of the response at 10 kHz against a 31-digit solve, for 0.5 dB Chebyshev ladders of order 3 to 9: plain (solid), and after one refinement step in double (dashed), with the response's own size (labels). order 3: 3.0e-16 → 0.0e+0, |H| = 2.3e-4; order 4: 1.6e-14 → 2.0e-16, |H| = 1.7e-5; order 5: 1.1e-12 → 0.0e+0, |H| = 6.8e-7; order 6: 4.2e-14 → 2.7e-16, |H| = 4.9e-8; order 7: 2.0e-12 → 2.2e-16, |H| = 1.8e-9; order 8: 1.0e-11 → 2.0e-16, |H| = 1.3e-10; order 9: 1.4e-10 → 3.3e-16, |H| = 4.9e-12. The plain error grows as the stopband deepens — not monotonically, since the even orders' stopbands are shallower at this frequency, but always under the round-off divided by the response — and the refined one does not move. The deeper the stopband, the more a refinement step is worth, and it costs one matrix–vector product and one pair of triangular solves.
Fig. 4 The response’s relative error at 10 kHz against a 31-digit solve, for ladder filters of order 3 to 9: plain (solid), and after one refinement step in double (dashed). From 3.0 × 10⁻¹⁶ at third order to 1.4 × 10⁻¹⁰ at ninth, where the response is 4.9 × 10⁻¹²; refined, every order is at round-off.

The deeper the stopband, the smaller the response and the more the plain solve loses: 3.0×10−163.0\times10^{-16} at third order, 1.1×10−121.1\times10^{-12} at fifth, 1.4×10−101.4\times10^{-10} at ninth, where the response at ten times the cutoff is 4.9×10−124.9\times10^{-12} of the input. The even orders lose less than their odd neighbours, because their stopbands are shallower at this frequency, and every order stays under the round-off divided by its response. After one step every order is at round-off. A ninth-order filter’s stopband, which the plain solve reports to four significant figures, is reported to sixteen after a single matrix–vector product and two triangular solves — a cost of a few per cent on top of the solve.

Every derivative, and the one that is zero computed sensitivities with a transposed solve on the same factorisation; refinement is the same economy put to a different use. The factorisation is the expensive part of any solve, and once it is done, both a derivative and a correction are nearly free.

The bridge, which cannot be refined

The bridge of the matrix that is ill, and the answer that is not loses one digit per decade of imbalance and has none left at a part in 101510^{15}. The earlier essay found that a pair of doubles recovers every digit. Refinement does not.

The bridge cannot be refined, because it loses its digits twice outside the solve: once storing its answer as two node voltages, once storing its data as conductances. computed by solving, not by drawing. A resistive bridge walked towards balance, its output the difference of two node voltages near 0.5 V. Against the drawn bridge's exact δ/2(2 + δ): plain (solid) and after two steps of refinement in double (dashed), both on the line of round-off over δ; and with the node voltages carried as pairs of doubles through four steps (dots). Against the network the matrix actually holds — its conductances and its diagonal sums each rounded to a double — the paired answer (small dots, drawn at 10⁻¹⁸ where it is exact). δ = 1e-2: 4.7e-15, 4.7e-15, 6.7e-16; stored 0.0e+0; δ = 1e-4: 5.4e-13, 5.4e-13, 4.8e-13; stored 0.0e+0; δ = 1e-6: 1.3e-10, 1.3e-10, 1.6e-10; stored 0.0e+0; δ = 1e-8: 1.1e-9, 1.1e-9, 6.0e-9; stored 0.0e+0; δ = 1e-10: 2.3e-6, 2.3e-6, 3.0e-6; stored 0.0e+0; δ = 1e-12: 8.9e-5, 8.9e-5, 6.8e-5; stored 0.0e+0; δ = 1e-14: 8.0e-4, 8.0e-4, 2.5e-3; stored 0.0e+0. Refinement in double changes nothing, because each node voltage is already right to its last bit. Pairs of doubles give the stored network's answer exactly — and the stored network is not the drawn one: rounding 1/R₃ and G₃ + G₄ moved the answer by about round-off over δ before any solving began.
Fig. 5 A resistive bridge walked towards balance. Against the drawn bridge’s exact output: plain (solid) and refined twice in double (dashed), both on the line of round-off over δ; with the node voltages carried as pairs of doubles (dots), still on it. Against the network the matrix actually holds, the paired answer is exact (small dots, at 10⁻¹⁸).

Plainly solved and refined twice in double, the bridge’s output error is the same at every imbalance — 5.4×10−135.4\times10^{-13} at δ=10−4\delta = 10^{-4}, 8.9×10−58.9\times10^{-5} at 10−1210^{-12} — and on the line of round-off divided by δ\delta. Refinement found nothing to correct, because there was nothing wrong with the solve: both node voltages were already right to their last bit. The output is their difference, two numbers near 0.5 that agree to all but δ\delta of their value, and two doubles near 0.5 cannot carry a difference smaller than their own round-off. The loss is in storing the answer as two node voltages, which happens after the solve and is invisible to its residual.

Carrying the node voltages as pairs of doubles through the refinement removes that loss, and the dots show what is left: an error still on the same line. Measured against the network the matrix actually holds, the paired answer is exact. The network the matrix holds is not the one that was drawn: its conductances are 1/R31/R_3 rounded to a double and its diagonal entry is G3+G4G_3 + G_4 rounded to a double, and each rounding moves the bridge’s output by about round-off over δ\delta — the same size as the first loss. The bridge loses its digits twice, both times in storage: once storing its data as conductances, once storing its answer as node voltages. The earlier essay’s pair of doubles recovered them because it built the matrix in pairs too.

Three places a digit can go

Taken with the earlier essays, the networks now separate cleanly by where their digits were lost.

In the elimination. The filter’s stopband. The matrix and the data are fine, the arithmetic is wide enough, and the elimination perturbed some rows more than round-off relative to their own size. One step of refinement in working precision recovers everything, for a few per cent of the cost of the solve.

In the storage of the answer. The bridge’s output, a small difference of two stored node voltages. No refinement of the voltages can help; only carrying them in more digits, or choosing unknowns whose values are the small quantity itself — the kind of change the node that is not in the circuit measured when it moved the reference node, which here would make the bridge’s output a node voltage that refinement could then refine.

In the storage of the data. The bridge’s conductances, which carry an error of round-off over δ before anything is solved. Nothing downstream recovers this; the answer the arithmetic computes is exactly right for a network that differs from the drawn one. And beyond all three lies the floor that outlives the arithmetic: the filter synthesis, whose loss is in the data in the deeper sense that the problem itself is ill posed, and where more digits made things worse.

The habit that separates them is an old one, and the one that one step, computed twice applied to a transient: compute the same quantity two ways, and attribute the difference. A refinement step is a second route that costs almost nothing and splits the first category from the other two.

Keeping what the arithmetic threw away

There is a family resemblance worth naming, because the same move appears in digital filtering. The rounding a section keeps found that a fixed-point filter section which remembers the error each rounding makes, and adds it back into the next computation, loses none of the accuracy a plain section loses to its dead band: the error was known exactly at the moment it was made, and discarding it was the only thing wrong. Refinement is the same move in a linear solve. The residual is the error the elimination made, measured against the original equations; the plain solve throws it away; one step keeps it and feeds it back.

In both cases the repair costs almost nothing because it uses information the computation already had, and in both cases it recovers everything the plain computation lost to its own procedure and nothing it lost elsewhere. The filter section’s error feedback cannot correct the quantisation of its input, which arrived already rounded; refinement cannot correct the bridge’s stored conductances, which arrived already rounded. The two repairs draw the same line between a loss made by the algorithm and a loss carried in by the data.

What the refinement does not settle

The figures use dense Gaussian elimination with partial pivoting, the solver used for every network solved here. A sparse solver that orders its eliminations to reduce fill-in may perturb the stopband rows differently, and the size of the plain solve’s componentwise error is a property of the elimination order as much as of the network; the refinement’s effect — componentwise stability in one step — should not depend on it, but the size of what it recovers would. And the networks are small: a few dozen unknowns. A refinement step on a large circuit simulation costs one more back-substitution per frequency, which is cheap, but the matrix–vector product for the residual must be formed from the original matrix, which a solver that factorises in place no longer has unless it kept a copy.

The numbers

The fifth-order ladder filter’s response at ten times its cutoff is 1.1×10−121.1\times10^{-12} wrong solved once in double, and within 2.4 units of round-off after one refinement step in the same precision; holding the residual in a pair of doubles changes only the floor. The plain solve is normwise backward stable to 1.4×10−181.4\times10^{-18} and componentwise only to 5.3×10−135.3\times10^{-13} in the stopband rows; one step makes it 9.8×10−179.8\times10^{-17}. At ninth order the plain error is 1.4×10−101.4\times10^{-10} and the refined one round-off. The bridge refines to nothing: its node voltages were already exact, and its digits are lost storing their difference and storing its conductances, each by about round-off over δ\delta.

Still open: a reference that refines, a sweep that reuses, and a residual that warns

The bridge with its reference at a bridge node. Moving the reference to one side of the bridge makes the output a node voltage. Whether refinement in double then recovers the output to round-off — leaving only the data’s storage error — would turn the second category into the first by a change of unknowns, and measure what that costs in the matrix’s condition.

Refinement across a sweep. A frequency sweep solves a matrix that changes slowly from point to point. A factorisation at one frequency, refined with residuals at the next, might converge in a few steps without a new factorisation, and the number of steps it needs against the frequency step is the cost curve of a cheaper sweep.

The residual as an alarm. A componentwise backward error is computed from the residual and costs no extra solve. Whether its size, row by row, predicts which components of a plain solve have lost digits — and so whether a simulator could refine only when the alarm sounds — is a test this essay’s figures already contain the data for.

Part 4 on conditioning

One argument about Conditioning, and one of 4 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

Closed formConditioningLadder filterModel rangeNumerical errorReference nodeVerification