Expand description
Shared numeric substrate: root finding, quadrature, dense linear algebra
and least squares, and minimisation over f64.
These are the general numeric routines geometry algorithms build on –
curve and surface fitting, fairing, projection and inversion – in one
place instead of re-derived inline. The reference designs are OCCT’s
math package, QUADPACK, Brent (1973) and MINPACK.
| Need | Routine |
|---|---|
a root of f between two points of opposite sign | find_root |
| every real root of a polynomial in an interval | Polynomial::real_roots |
integral f with an error estimate | integrate |
| fixed Gauss rule for an integrand of known degree | GaussLegendre |
| square system | Lu |
| symmetric positive definite system | Cholesky |
| large sparse symmetric positive definite system | conjugate_gradient on a SparseMatrix |
| linear least squares, rank | Qr, least_squares |
| least squares with equality constraints | constrained_least_squares |
| nonlinear least squares, nonlinear equations | levenberg_marquardt |
minimum of f on an interval | minimize_scalar |
§Contract
- Non-finite input is refused by name (
NumericError::NonFiniteInput), as is a non-finite value from a caller’s function. - Every answer says how far it can be trusted: a bracket that contains the root, an error estimate, a condition estimate, or an explicitly unresolved region. Which of these is a proven bound and which is an estimate is stated on each field.
- Iterative routines report a
Status. One that ran out of budget still returns its best value and estimate; itsconverged()accessor turns that intoNumericError::NotConvergedfor callers that only accept a met tolerance. - Singular, rank-deficient, non-symmetric and indefinite matrices are refused, never solved into infinities.
There are no geometry types here and no dependencies: values are plain
f64 slices, a small row-major Matrix and a compressed-row
SparseMatrix.
Re-exports§
pub use error::NumericError;pub use error::NumericResult;pub use error::Status;pub use linalg::constrained_least_squares;pub use linalg::least_squares;pub use linalg::Cholesky;pub use linalg::ConstrainedSolution;pub use linalg::LeastSquaresSolution;pub use linalg::LinearSolution;pub use linalg::Lu;pub use linalg::Matrix;pub use linalg::Qr;pub use optimize::levenberg_marquardt;pub use optimize::minimize_scalar;pub use optimize::LeastSquaresMinimum;pub use optimize::LevenbergMarquardtOptions;pub use optimize::Residuals;pub use optimize::ScalarMinimum;pub use optimize::Termination;pub use poly::Polynomial;pub use poly::PolynomialRoot;pub use poly::RootKind;pub use quad::integrate;pub use quad::GaussLegendre;pub use quad::Integral;pub use quad::IntegrationOptions;pub use root::find_root;pub use root::Root;pub use sparse::conjugate_gradient;pub use sparse::ConjugateGradientOptions;pub use sparse::ConjugateGradientSolution;pub use sparse::SparseMatrix;
Modules§
- error
- Refusals and convergence status shared by every routine.
- linalg
- Dense linear algebra for small and medium systems.
- optimize
- Minimisation: a bounded scalar minimiser and damped Gauss-Newton (Levenberg-Marquardt) for nonlinear least squares.
- poly
- Real polynomials in the power basis and all their real roots in an interval.
- quad
- Numerical integration of a scalar function over a finite interval.
- root
- Bracketed scalar root finding with guaranteed convergence.
- sparse
- Sparse matrices and the preconditioned conjugate-gradient solve.