cg function

Solve linear systems using the conjugate gradients method