The Lanczos and conjugate gradient algorithms