spectrafit_trust_region/lib.rs
1//! spectrafit-trust-region — a faer-native, graph-agnostic trust-region framework.
2//!
3//! This crate owns the *shared contract and vocabulary* of nonlinear
4//! least-squares fitting so that every solver method in the workspace
5//! (`spectrafit-levenberg-marquardt`, and the planned dogleg / Newton-CG
6//! crates) builds on one tested foundation, pure-Rust SIMD via
7//! [`faer`](https://docs.rs/faer) with no BLAS/C dependency.
8//!
9//! # Design
10//!
11//! * [`TrustRegionProblem`] is the only coupling point: an implementor supplies
12//! weighted residuals and a weighted Jacobian written into caller-owned `faer`
13//! buffers (plus matrix-free `J·v` / `Jᵀ·u` operators for Krylov methods), and
14//! applies any parameter-space projection (bounds reflection, expression-tied
15//! parameters) in [`TrustRegionProblem::set_params`].
16//! * [`Report`] / [`Termination`] are the generic outcome types every method
17//! reports, so consumers speak one vocabulary regardless of which method ran.
18//!
19//! Each concrete *method* (its outer control loop and step computation) lives in
20//! its own crate on top of this framework — e.g. the LM / TRF / geodesic loop is
21//! in `spectrafit-levenberg-marquardt`. The framework depends only on
22//! `spectrafit-types` (for [`CoreError`]) and `faer`, so it sits as a leaf next
23//! to `spectrafit-types` in the workspace DAG.
24//!
25//! [`CoreError`]: spectrafit_types::CoreError
26#![warn(missing_docs)]
27
28mod driver;
29mod problem;
30mod report;
31mod step;
32
33pub use driver::{minimize_tr, TrustRegionConfig};
34pub use problem::TrustRegionProblem;
35pub use report::{Report, Termination};
36pub use step::{StepResult, Subproblem, SubproblemStep};
37
38#[cfg(test)]
39mod tests;