Skip to main content

spectrafit_newton_cg/
lib.rs

1//! spectrafit-newton-cg — matrix-free Newton-CG (Steihaug–Toint) trust region.
2//!
3//! One *method* on the graph-agnostic
4//! [`spectrafit-trust-region`](spectrafit_trust_region) framework: it supplies
5//! the [`SteihaugStep`] subproblem solver — truncated conjugate gradients that
6//! never form `JᵀJ`, using only matrix-free `H·v = J̃ᵀ(J̃·v)` products — and a
7//! thin [`minimize`] entry point; the framework owns the Δ-radius control loop.
8//!
9//! This is the large-scale lever: the per-iteration cost scales with the number
10//! of residuals, not `p²`, so it stays cheap when the parameter count is large
11//! or `JᵀJ` is ill-conditioned (the regime where forming the normal equations
12//! squares the condition number).
13#![warn(missing_docs)]
14
15mod driver;
16mod problem;
17mod step;
18
19pub use driver::minimize;
20pub use problem::TrustRegionProblem;
21pub use step::SteihaugStep;
22
23// Re-export the framework config + outcome types so consumers depend only on
24// this crate for the full Newton-CG API surface.
25pub use spectrafit_trust_region::{Report, Termination, TrustRegionConfig};
26
27#[cfg(test)]
28mod tests;