We have now derived all the equations we need to formulate the Conjugate Gradients algorithm. Each step of CG is described below.

Compute the step-size:

The solution increments are conjugate with all the previous steps:

The residual is orthogonal to all the previous residuals:

We use our computationally efficient equation for the search directions:

The search directions are conjugate with each other:

Finally, we increase the iteration index: