LION.classical_algorithms.conjugate_gradient

LION.classical_algorithms.conjugate_gradient(matmul_closure, d, x0, max_iter, tol)[source]

Solves A x = d by the conjugate gradient method, A symmetric positive definite, given as matmul_closure(x) = A x. Starts from x0; stops after max_iter iterations or when the relative residual ||d - A x|| / ||d|| is below tol. Returns x.