We present a deflated version of the conjugate gradient algorithm for solvi
ng linear systems. The new algorithm can be useful in cases when a small nu
mber of eigenvalues of the iteration matrix are very close to the origin. I
t can also be useful when solving linear systems with multiple right-hand s
ides, since the eigenvalue information gathered from solving one linear sys
tem can be recycled for solving the next systems and then updated.