pysolver_view.roots.solvers.linear_model module#
Dense trust-region subproblems with reusable QR and lazy SVD factors.
The ordinary full-rank Gauss–Newton path uses column-pivoted QR. Hybrid Broyden updates retain that permutation and update the factors in quadratic work; a triangular condition estimate guards this no-longer-pivoted update. An SVD supplies minimum-norm solutions for ill-conditioned models and solves the damped LM subproblem. No normal-equation matrix is formed.
- class pysolver_view.roots.solvers.linear_model.LinearModel(a, f, stats=None, refresh_interval=25, *, compute_gradient=True)[source]#
Bases:
objectFactor and update the linear residual model
f + a @ step.The matrix
ais the Jacobian in fixed scaled coordinates,fis the residual at the accepted base, andg = a.T @ fis the model gradient. The attributesqandrare QR factors ofa[:, perm]. The cached damping value_muis normalized by the largest singular value squared.ahas at least as many rows as columns.statsis a shared mutable counter dictionary; costs accumulate across model instances. A failedupdatereturns False and the caller must discard this model and obtain a freshly evaluated Jacobian. Refreshing QR everyrefresh_intervalsuccessful updates limits accumulated factorization drift; it does not evaluate a Jacobian or discard the Broyden approximation.- property gauss_newton#
Return the cached unconstrained least-squares step for the current model.
Use a guarded triangular QR solve when possible; otherwise use an SVD minimum-norm solution with a numerical-rank cutoff. The returned cached array is internal state; step() supplies a copy when returning it to the driver.
- levenberg_marquardt_step(radius)[source]#
Return the unconstrained step if feasible, otherwise solve LM damping.
- property newton_raphson#
Return a strict square full-rank Newton direction without rank truncation.
A numerically singular model raises LinAlgError rather than silently replacing Newton with a pseudoinverse least-squares direction.
- property numerical_rank#
Return full rank for guarded QR, otherwise the SVD numerical rank.
- powell_hybrid_step(radius)[source]#
Return the unconstrained step if feasible, otherwise follow the dogleg.
- step(method, radius)[source]#
Select a named subproblem step for experiments using the model directly.
Solver entry points bind the explicit step functions once before iteration. Short method aliases remain supported by this compatibility interface.
- update(correction, direction, f_new)[source]#
Apply
a += outer(correction, direction)and anchor atf_new.A finite rejected trial can still improve the Jacobian approximation; its caller supplies the unchanged accepted residual in that case. Nonfinite input, gradient overflow, or a poorly conditioned updated QR requests an exact-Jacobian refresh by returning False.