jaxopt.linear_solve.solve_cg

jaxopt.linear_solve.solve_cg(matvec, b, ridge=None, init=None, **kwargs)[source]

Solves A x = b using conjugate gradient.

It assumes that A is a Hermitian, positive definite matrix.

Parameters
  • matvec (Callable) – product between A and a vector.

  • b (Any) – pytree.

  • ridge (Optional[float]) – optional ridge regularization.

  • init (Optional[Any]) – optional initialization to be used by conjugate gradient.

  • **kwargs – additional keyword arguments for solver.

Return type

Any

Returns

pytree with same structure as b.