gauss_newton_cg ========================= .. py:module:: jaxns.experimental.solvers.gauss_newton_cg .. rubric:: :code:`jaxns.experimental.solvers.gauss_newton_cg` .. rubric:: Module Contents .. py:data:: DomainType .. py:data:: ObjectiveRet .. py:data:: CT .. py:function:: convert_to_real(x) Return a real-valued twin of `x` and a merge-back function. .. py:class:: NewtonDiagnostic Bases: :py:obj:`NamedTuple` .. py:attribute:: iteration :type: jaxns.internals.types.IntArray .. py:attribute:: g_norm :type: jaxns.internals.types.FloatArray .. py:attribute:: mu :type: jaxns.internals.types.FloatArray .. py:attribute:: damping :type: jaxns.internals.types.FloatArray .. py:attribute:: cg_iters :type: jaxns.internals.types.IntArray .. py:attribute:: f :type: jaxns.internals.types.FloatArray .. py:attribute:: f_prop :type: jaxns.internals.types.FloatArray .. py:attribute:: f_quad :type: jaxns.internals.types.FloatArray .. py:attribute:: delta_f_pred :type: jaxns.internals.types.FloatArray .. py:attribute:: delta_f_actual :type: jaxns.internals.types.FloatArray .. py:attribute:: gain_ratio :type: jaxns.internals.types.FloatArray .. py:attribute:: accepted :type: jaxns.internals.types.BoolArray .. py:attribute:: in_trust_region :type: jaxns.internals.types.BoolArray .. py:attribute:: delta_x_norm :type: jaxns.internals.types.FloatArray .. py:attribute:: ddelta_x_norm :type: jaxns.internals.types.FloatArray .. py:function:: newton_cg_solver(obj_fn, x0, args = (), maxiter = 100, maxiter_cg = 100, gtol = 3e-05, p_accept = 0.01, p_lower = 0.25, p_upper = 1.1, mu_init = 1.0, mu_min = 1e-06, mu_in_factor = 5, mu_out_factor = 0.1, approx_hvp = False, verbose = False) Trust-region Newton-CG minimiser. Identical call signature and adaptive-μ logic as `lm_solver`, but uses a scalar objective instead of residuals, and solves (H + damping·I) δx = -∇f by CG with Hessian–vector products. :returns: * **x_final** (pytree matching `x0` (merged back to complex if needed)) * **diagnostics** (NewtonDiagnostic[...] array with length = `maxiter`)