how to code up the Conjugate Gradient solver