NewtonInfo#

class t3toolbox.backend.optimizers.NewtonInfo#

Per-iteration diagnostics passed to a newton_cg callback – everything one Newton step produces, so a custom callback (or the display in t3toolbox.backend.optimizer_display) can report anything without the loop anticipating it. x_cores (the point before the step) and lm (its LocalModel – residual / sample / frame) are carried so a callback can compute per-block errors or evaluate a validation forward. The step-related fields are None on the final converged line (no CG / line search ran). The scalar subset (all but x_cores / lm / timing) is what lands in stats['history'].

Five strings (2026.3.0): newton_cg sets the first four on every row it emits, so a history consumer can filter by them, and stop_reason on its last row. All default to None, so a hand-built row (a display test) needs none of them:

  • g0_reference – which Newton-stop reference g0norm is: 'zero' (the gradient norm at the zero tensor of these ranks, at the canonical zero-point frame), 'warm_start' (the initial ‖g‖), 'cone' (the gradient norm at the zero tensor on the aligned frame), or 'override' (g0norm_newton was given).

  • cg_reference – the CG forcing term’s reference: 'override' iff g0norm_cg was given, else equal to g0_reference (CG inherits the Newton reference).

  • step_control – the step-acceptance mode: 'line_search' (Armijo backtracking along the retraction) or 'trust_region' (one trial at α = 1, accepted on the ratio ρ; Steihaug CG).

  • hessian – the row’s model: 'gauss_newton' or 'exact' (the model that solved the step; on the converged row, the model built there). The run’s mode on every row, except under hessian='switch' (below).

  • stop_reason – set on the run’s last row only (None before it): 'gradient' (the relative stop fired: the converged row), 'max_newton' (the iteration cap), 'line_search' (Armijo exhausted under on_line_search_failure='stop'), 'objective_floor' (a rejected trust-region step whose predicted change is below the objective’s floating-point resolution – the attainable accuracy is reached; not a failure) or 'trust_region_floor' (rejections drove the radius below 1e-12 of its initial value); the same value as stats['stop_reason'].

Mode-dependent fields. A line-search row has ls_steps / ls_failed set and tr_* None; a trust-region row has tr_radius (the radius this trial was bounded by) and tr_accepted set, ls_steps = ls_failed = None and alpha = 1.0. A rejected trust-region row keeps x_cores (the next row starts from the same point, with the same local model). pKp / lift_sigma_min / lift_eps are set only on a row whose hessian is 'exact' (the last two only on a geometry whose curvature data carries them, i.e. the manifold one at d > 1). The CG outcome is exactly one of cg_converged, cg_boundary, cg_truncated or (none of them) the iteration cap.

The switch (newton_cg(hessian='switch')). A row’s hessian is 'gauss_newton' in the Gauss-Newton phase and 'exact' from the switch on. On a Gauss-Newton-phase row lm is the Gauss-Newton view of the point’s exact-mode build (the model that solved the step, the same object across a rejected trial; its gradient recomputes the misfit transpose), so pKp and the lift diagnostics are None there, as on a Gauss-Newton run’s rows. Five fields, None outside switch mode and history fields only in switch mode (the display prints them as a Gauss-Newton-phase row’s sw segment: format_newton_iter()):

  • switch_e_gn – every Gauss-Newton-phase row with a step: |Δf − m_GN(s)|, m_GN(s) the row’s predicted change (α·slope + ½α²·pHp; α = 1 in the trust region).

  • switch_pKp, switch_e_n – the tracked rows (the countable ones, or every Gauss-Newton-phase step row under switch_track='all'): the curvature term ⟨p, Lᵀ K_N L p⟩ of the exact build (not in pHp) and |Δf − m_N(s)| with m_N(s) = m_GN(s) + ½α²·switch_pKp.

  • switch_count – every Gauss-Newton-phase row: the count of consecutive hits after this row (0: a reset); the converged row’s is the count carried to it.

  • switch_fired – every switch-mode row: True on the row whose count reached switch_k, else False.

timing is a NewtonTiming with newton_cg(timing=True), else None; like x_cores and lm it is not a history field (stats['timing']['rows'] holds the records as dicts). The display prints it as the row’s time line (format_newton_iter()).

iteration: int#
objective: float#
gnorm: float#
g0norm: float#
converged: bool#
x_cores: t3toolbox.backend.common.typ.Any = None#
lm: t3toolbox.backend.common.typ.Any = None#
misfit: t3toolbox.backend.common.typ.Optional[float] = None#
regularization: t3toolbox.backend.common.typ.Optional[float] = None#
forcing_eta: t3toolbox.backend.common.typ.Optional[float] = None#
cg_tol: t3toolbox.backend.common.typ.Optional[float] = None#
cg_iters: t3toolbox.backend.common.typ.Optional[int] = None#
cg_maxiter: t3toolbox.backend.common.typ.Optional[int] = None#
cg_resid: t3toolbox.backend.common.typ.Optional[float] = None#
cg_converged: t3toolbox.backend.common.typ.Optional[bool] = None#
cg_truncated: t3toolbox.backend.common.typ.Optional[bool] = None#
ls_steps: t3toolbox.backend.common.typ.Optional[int] = None#
ls_failed: t3toolbox.backend.common.typ.Optional[bool] = None#
alpha: t3toolbox.backend.common.typ.Optional[float] = None#
slope: t3toolbox.backend.common.typ.Optional[float] = None#
pHp: t3toolbox.backend.common.typ.Optional[float] = None#
delta_f: t3toolbox.backend.common.typ.Optional[float] = None#
rho: t3toolbox.backend.common.typ.Optional[float] = None#
step_rel: t3toolbox.backend.common.typ.Optional[float] = None#
wall_time: t3toolbox.backend.common.typ.Optional[float] = None#
g0_reference: t3toolbox.backend.common.typ.Optional[str] = None#
cg_reference: t3toolbox.backend.common.typ.Optional[str] = None#
step_control: t3toolbox.backend.common.typ.Optional[str] = None#
stop_reason: t3toolbox.backend.common.typ.Optional[str] = None#
hessian: t3toolbox.backend.common.typ.Optional[str] = None#
tr_radius: t3toolbox.backend.common.typ.Optional[float] = None#
tr_accepted: t3toolbox.backend.common.typ.Optional[bool] = None#
cg_boundary: t3toolbox.backend.common.typ.Optional[bool] = None#
pKp: t3toolbox.backend.common.typ.Optional[float] = None#
lift_sigma_min: t3toolbox.backend.common.typ.Optional[float] = None#
lift_eps: t3toolbox.backend.common.typ.Optional[float] = None#
timing: t3toolbox.backend.common.typ.Optional[NewtonTiming] = None#
switch_pKp: t3toolbox.backend.common.typ.Optional[float] = None#
switch_e_gn: t3toolbox.backend.common.typ.Optional[float] = None#
switch_e_n: t3toolbox.backend.common.typ.Optional[float] = None#
switch_count: t3toolbox.backend.common.typ.Optional[int] = None#
switch_fired: t3toolbox.backend.common.typ.Optional[bool] = None#