conatus.expert.NewtonKrylovHookstep

class conatus.expert.NewtonKrylovHookstep(*, tol=REQUIRED, max_iterations=40, gmres_rtol=0.001, gmres_max_iterations=60, delta0=1.0, delta_min=1e-10, delta_max=10.0, rho_bad=0.1, rho_good=0.75, radii='absolute')[source]

Bases: object

Newton–Krylov with hookstep. tol (the accuracy target, on ‖R‖/scale) is required; the algorithm controls (budget, inexact-GMRES tolerance and Krylov budget, trust radii and how they are read, acceptance ratios) have declared defaults (HOOKSTEP_DEFAULTS), printed by explain(). radii="relative" reads delta0, delta_min and delta_max as fractions of the norm of the starting unknowns ("absolute", the default: in the norm of the unknowns).

Parameters:
  • tol (float)

  • max_iterations (int)

  • gmres_rtol (float)

  • gmres_max_iterations (int)

  • delta0 (float)

  • delta_min (float)

  • delta_max (float)

  • rho_bad (float)

  • rho_good (float)

  • radii (str)

property gmres_maxiter: int

Former name of gmres_max_iterations (read-only, kept for v0.1 readers).

explain()[source]

Accuracy target (given) and every algorithm control, marked given or default.

Return type:

str

solve(residual, jvp, z0, *, scale, log=None, on_iteration=None)[source]

Iterate from z0. scale normalizes ‖R‖ for the stopping test (declared by caller). on_iteration (optional, explicit) receives each iteration’s record, e.g. the Studio telemetry Telemetry.newton_callback(); it never changes the iteration.

Parameters:
  • residual (Callable[[ndarray], ndarray])

  • jvp (Callable[[ndarray, ndarray], ndarray])

  • z0 (ndarray)

  • scale (float)

  • log (Callable[[str], None] | None)

  • on_iteration (Callable[[dict], None] | None)

Return type:

NewtonKrylovResult