Crates.io | levenberg-marquardt |
lib.rs | levenberg-marquardt |
version | 0.14.0 |
source | src |
created_at | 2020-01-05 23:31:07.815545 |
updated_at | 2024-07-22 20:45:42.705594 |
description | Levenberg-Marquardt algorithm built on top of nalgebra |
homepage | |
repository | https://github.com/rust-cv/levenberg-marquardt |
max_upload_size | |
id | 195624 |
size | 197,776 |
Solver for nonlinear least squares problems
The implementation is a port of the classic MINPACK implementation of the Levenberg-Marquardt (LM) algorithm. This version of the algorithm is sometimes referred to as exact LM.
All current unit tests indicate that we achieved identical output (on a floating-point level)
to the MINPACK implementation, especially for rank deficient unstable problems.
This was mainly useful for testing.
The Fortran algorithm was extended with NaN
and inf
handling, similar to what lmfit does.
The crate offers a feature called minpack-compat
which sets floating-point constants
to the ones used by MINPACK and removes the termination criterion of "zero residuals".
This is necessary for identical output to MINPACK but generally not recommended.
See the docs for detailed information.
impl LeastSquaresProblem<f64> for Problem {
// define this trait for the problem you want to solve
}
let problem = Problem::new(initial_params);
let (problem, report) = LevenbergMarquardt::new().minimize(problem);
assert!(report.termination.was_successful());
Software:
One original reference for the algorithm seems to be
Moré J.J. (1978) The Levenberg-Marquardt algorithm: Implementation and theory. In: Watson G.A. (eds) Numerical Analysis. Lecture Notes in Mathematics, vol 630. Springer, Berlin, Heidelberg.
by one of the authors of MINPACK.
The algorithm is also described in the form as implemented by this crate in the book "Numerical Optimization" by Nocedal and Wright, chapters 4 and 10.