# cg_solver¶

psi4.driver.p4util.cg_solver(rhs_vec, hx_function, preconditioner, guess=None, printer=None, printlvl=1, maxiter=20, rcond=1e-06)[source]

Solves the $$Ax = b$$ linear equations via Conjugate Gradient. The A matrix must be a hermitian, positive definite matrix.

Parameters:
Returns:

ret – Solved x vectors and r vectors.

Return type:

List[Matrix]

Notes

This is a generalized cg solver that can also take advantage of solving multiple RHS’s simultaneously when it is advantageous to do so.