pysolver_view.roots.solvers.options module#

Validated options for trust-region and line-search root solvers.

class pysolver_view.roots.solvers.options.BacktrackingOptions(armijo_c1: float = 0.0001, contraction_factor: float = 0.5, max_backtracks: int = 30, step_limits: ~pysolver_view.roots.solvers.options.StepLimitOptions | None = <factory>)[source]#

Bases: object

Configure Armijo backtracking and an optional scaled displacement envelope.

step_limits=None disables only the envelope. max_backtracks=0 still checks the initial trial against Armijo, but does not retry a rejected point.

armijo_c1: float = 0.0001#
contraction_factor: float = 0.5#
max_backtracks: int = 30#
step_limits: StepLimitOptions | None#
class pysolver_view.roots.solvers.options.NewtonOptions(x_scale: object = 1.0, residual_tol: float = 1e-08, xtol: float = 1e-12, gtol: float = 1e-12, max_iterations: int = 500, max_nfev: int = 5000, finite_diff_step: float = 1e-07, derivative_method: str = '2-point', derivative_abs_step: object = None, history_level: str = 'full', backtracking: ~pysolver_view.roots.solvers.options.BacktrackingOptions | None = <factory>, jacobian_scaling: bool = True, first_step_fraction: float = 1.0, step_growth_factor: float = 1.5)[source]#

Bases: object

Configure Newton-Raphson or Gauss-Newton with optional backtracking.

Omission enables protected backtracking. Explicit backtracking=None selects valid steps without a decrease test, even if the residual increases. With the default first_step_fraction=1 these are full Newton steps. Root success always requires residual_tol. max_iterations counts trial attempts, max_nfev counts every residual call including undefined trials and finite-difference probes. For Gauss-Newton, gtol detects a negligible projected residual change ||A z|| <= gtol * min(1, ||F||), rather than testing an arbitrarily scaled gradient. Newton-Raphson has no gradient-based early-exit test.

jacobian_scaling=True equilibrates linear-system columns using running maximum norms at fresh Jacobians. This leaves x_scale, derivative probes, and physical backtracking limits unchanged. Full-rank Newton/Gauss-Newton directions are unchanged in exact arithmetic; rank-deficient minimum-norm Gauss-Newton directions can change. False disables numerical equilibration.

first_step_fraction is a dimensionless initial multiplier in (0, 1] of the Newton direction. After each accepted move this cap grows by step_growth_factor (finite and >= 1), up to 1. It is independent of the absolute x_scale displacement envelope; both restrictions apply when backtracking is enabled, and Armijo may shorten the trial further. Rejected trials do not advance the schedule. A growth factor of 1 fixes the cap. The defaults leave existing full-step and backtracking behavior unchanged.

backtracking: BacktrackingOptions | None#
derivative_abs_step: object = None#
derivative_method: str = '2-point'#
finite_diff_step: float = 1e-07#
first_step_fraction: float = 1.0#
gtol: float = 1e-12#
history_level: str = 'full'#
jacobian_scaling: bool = True#
max_iterations: int = 500#
max_nfev: int = 5000#
residual_tol: float = 1e-08#
step_growth_factor: float = 1.5#
x_scale: object = 1.0#
xtol: float = 1e-12#
class pysolver_view.roots.solvers.options.StepControlOptions(initial_radius: float = 1.0, max_radius: float = 100.0, growth_factor: float = 2.0, shrink_factor: float = 0.25, acceptance_ratio: float = 0.1, residual_tol: float = 1e-08, xtol: float = 1e-12, gtol: float = 1e-12, max_iterations: int = 500, max_nfev: int = 5000, finite_diff_step: float = 1e-07, derivative_method: str = '2-point', derivative_abs_step: object = None, x_scale: object = 1.0, history_level: str = 'full', jacobian_scaling: bool = True)[source]#

Bases: object

Control scaled trial distances and termination.

x_scale contains fixed characteristic variable distances (not MINPACK diag; the correspondence is diag = 1 / x_scale). initial_radius is an absolute scaled distance, independent of the initial point. max_radius bounds every trial. After a successful boundary step with ratio >= 0.75, the radius may grow by growth_factor; poor/undefined trials shrink it by shrink_factor. A growth factor of one prevents regrowth, including after recovery. Radii never exceed max_radius.

Success requires norm(fun(x)) <= residual_tol. Small steps, a stationary least-squares point, and exhausted budgets are failures, not roots. max_iterations counts all trial attempts (accepted or rejected). max_nfev includes initial, trial, and numerical-derivative evaluations. Forward difference probes move finite_diff_step * x_scale[j] in x[j].

jacobian_scaling=True adds numerical column equilibration without changing the physical meaning of x_scale or the radius cap. Numerical trust steps are shortened along their ray when required by the physical envelope. Scaling updates only at fresh Jacobians and stays fixed through Broyden updates and trial retries. False selects the original fixed-scale geometry.

acceptance_ratio: float = 0.1#
derivative_abs_step: object = None#
derivative_method: str = '2-point'#
finite_diff_step: float = 1e-07#
growth_factor: float = 2.0#
gtol: float = 1e-12#
history_level: str = 'full'#
initial_radius: float = 1.0#
jacobian_scaling: bool = True#
max_iterations: int = 500#
max_nfev: int = 5000#
max_radius: float = 100.0#
residual_tol: float = 1e-08#
shrink_factor: float = 0.25#
x_scale: object = 1.0#
xtol: float = 1e-12#
class pysolver_view.roots.solvers.options.StepLimitOptions(initial_limit: float = 1.0, max_limit: float = 100.0, growth_factor: float = 2.0)[source]#

Bases: object

Bound scaled displacements and restore a reduced envelope gradually.

A failed initial trial carries the accepted step length into the next iteration’s envelope. A successful initial trial near the envelope permits growth toward max_limit. Numerical derivative probes have separate controls.

growth_factor: float = 2.0#
initial_limit: float = 1.0#
max_limit: float = 100.0#