# Iterative refinement

Iterative refinement is an iterative method proposed by James H. Wilkinson to improve the accuracy of numerical solutions to systems of linear equations.
When solving a linear system $A\mathbf {x} =\mathbf {b} \,,$ due to the compounded accumulation of rounding errors, the computed solution ${\hat {\mathbf {x} }}$ may sometimes deviate from the exact solution $\mathbf {x} _{\star }\,.$ Starting with $\mathbf {x} _{1}={\hat {\mathbf {x} }}\,,$ iterative refinement computes a sequence $\{\mathbf {x} _{1},\,\mathbf {x} _{2},\,\mathbf {x} _{3},\dots \}$ which converges to $\mathbf {x} _{\star }\,,$ when certain assumptions are met.

## Description

For $m=1,2,3,\dots \,,$ the mth iteration of iterative refinement consists of three steps:
* Compute the residual error r$_m$ $\mathbf {r} _{m}=\mathbf {b} -A\mathbf {x} _{m}\,.$
* Solve the system for the correction, c$_m$, that removes the residual error $A\mathbf {c} _{m}=\mathbf {r} _{m}\,.$
* Add the correction to get the revised next solution x$_{m+1}$ $\mathbf {x} _{m+1}=\mathbf {x} _{m}+\mathbf {c} _{m}\,.$
The crucial reasoning for the refinement algorithm is that although the solution for c$_m$ in step (ii) may indeed be troubled by similar errors as the first solution, ${\hat {\mathbf {x} }}$, the calculation of the residual r$_m$ in step (i), in comparison, is numerically nearly exact: You may not know the right answer very well, but you know quite accurately just how far the solution you have in hand is from producing the correct outcome (b). If the residual is small in some sense, then the correction must also be small, and should at the very least steer the current estimate of the answer, x$_m$, closer to the desired one, $\mathbf {x} _{\star }\,.$
The iterations will stop on their own when the residual r$_m$ is zero, or close enough to zero that the corresponding correction c$_m$ is too small to change the solution x$_m$ which produced it; alternatively, the algorithm stops when r$_m$ is too small to convince the linear algebraist monitoring the progress that it is worth continuing with any further refinements.
Note that the matrix equation solved in step (ii) uses the same matrix $A$ for each iteration. If the matrix equation is solved using a direct method, such as Cholesky or LU decomposition, the numerically expensive factorization of $A$ is done once and is reused for the relatively inexpensive forward and back substitution to solve for c$_m$ at each iteration.

## Error analysis

As a rule of thumb, iterative refinement for Gaussian elimination produces a solution correct to working precision if double the working precision is used in the computation of r, e.g. by using quad or double extended precision IEEE 754 floating point, and if A is not too ill-conditioned (and the iteration and the rate of convergence are determined by the condition number of A).
More formally, assuming that each step (ii) can be solved reasonably accurately, i.e., in mathematical terms, for every m, we have $A\left(I+F_{m}\right)\mathbf {c} _{m}=\mathbf {r} _{m}$
where ‖F$_m$‖$_∞$ < 1, the relative error in the m-th iterate of iterative refinement satisfies ${\frac {\lVert \mathbf {x} _{m}-\mathbf {x} _{\star }\rVert _{\infty }}{\lVert \mathbf {x} _{\star }\rVert _{\infty }}}\leq {\bigl\sigma \,\kappa (A)\,\varepsilon _{1}{\bigr )}^{m}+\mu _{1}\,\varepsilon _{1}+n\,\kappa (A)\,\mu _{2}\,\varepsilon _{2}$
where
* ‖·‖$_∞$ denotes the ∞-norm of a vector,
* κ(A) is the ∞-condition number of A,
* n is the order of A,
* ε$_1$ and ε$_2$ are unit round-offs of floating-point arithmetic operations,
* σ, μ$_1$ and μ$_2$ are constants that depend on A, ε$_1$ and ε$_2$
if A is "not too badly conditioned", which in this context means
and implies that μ$_1$ and μ$_2$ are of order unity.
The distinction of ε$_1$ and ε$_2$ is intended to allow mixed-precision evaluation of r$_m$ where intermediate results are computed with unit round-off ε$_2$ before the final result is rounded (or truncated) with unit round-off ε$_1$. All other computations are assumed to be carried out with unit round-off ε$_1$.