cg ============ .. py:module:: jaxns.experimental.solvers.cg .. rubric:: :code:`jaxns.experimental.solvers.cg` .. rubric:: Module Contents .. py:class:: CGDiagnostics Bases: :py:obj:`NamedTuple` .. py:attribute:: iterations :type: jaxns.internals.types.IntArray .. py:attribute:: final_res_norm :type: jaxns.internals.types.FloatArray .. py:data:: DomainType .. py:function:: cg_solve(A, b, x0, M = _identity, maxiter = 100, tol = 1e-05, atol = 0.0) Solve a linear system Ax = b using the conjugate gradient method. :param A: a square PSD linear operator :param b: the right-hand side :param x0: an initial guess for the solution :param M: a preconditioner for A :param maxiter: the maximum number of iterations, if None then size of b :param tol: the relative tolerance for the residual norm :param atol: the absolute tolerance for the residual norm :returns: the solution x and diagnostics