Expand description
spectrafit-varpro — Variable Projection (VarPro) solver for separable models.
A graph is separable when every model node has exactly one linear
parameter (amplitude) and the remaining parameters are nonlinear shape
parameters. Examples: Gaussian, Lorentzian, Voigt, step functions, Fano.
For such graphs varpro eliminates the linear amplitude dimensions from the optimisation, reducing it to a pure nonlinear problem over the shape params. This gives faster convergence and better numerical conditioning vs vanilla LM.
§Bounds
varpro has no native bounds support. When any nonlinear parameter has finite
bounds and options.solver == "varpro", we fall back to LM and log a
warning. With options.solver == "auto" we transparently fall back.
§Jacobian variant: Kaufman approximation, not full Golub-Pereyra
The projected-residual Jacobian that drives the nonlinear optimisation
step is supplied by the varpro crate (the [dependencies] varpro
entry in this crate’s Cargo.toml), not by this crate’s own code. That
crate implements the Kaufman (1975) approximation to the classic
Golub-Pereyra (1973) projected Jacobian — confirmed by its own module
doc comment (varpro v0.14.0, src/lib.rs, line 99): “The VarPro
algorithm implemented here follows (O’Leary2013), but uses the Kaufman
approximation to calculate the Jacobian.” Concretely, the full
Golub-Pereyra derivative of the projected residual has two terms; the
Kaufman approximation drops the second one (the term involving the
derivative of the projector P = I - Φ Φ⁺ itself), keeping only the
cheaper first term. This is the standard trade-off documented in the
literature: fewer FLOPs per Jacobian evaluation, at the cost of a
Gauss-Newton-only convergence-rate guarantee near the solution (full
Golub-Pereyra retains second-order terms that can matter on
ill-conditioned or rank-deficient projections) and a covariance that is
only an approximation of the true joint covariance over both linear and
nonlinear parameters. tests/parity/test_varpro_equivalence.py checks
empirically that, on a well-posed separable problem, this approximation
still converges to the same minimum as full joint LM — the
approximation changes the path and the covariance, not the optimum.
References:
- Golub, G., Pereyra, V. (1973). “The Differentiation of Pseudo-Inverses and Nonlinear Least Squares Problems Whose Variables Separate.” SIAM J. Numer. Anal. 10(2), 413-432.
- Kaufman, L. (1975). “A variable projection method for solving separable nonlinear least squares problems.” BIT 15, 49-57.
Structs§
- Graph
Separable Model - Implements varpro’s
SeparableNonlinearModeltrait for an arbitrary separable spectrafit graph.
Functions§
- is_
separable - Returns
truewhen every node in the graph is either separable (has anamplitudelinear param + nonlinear shape params) or invariant (all params linear). Returnsfalsefor unknown or non-conforming node types. - solve_
varpro - Run the varpro solver on one or more datasets sharing the same separable model.