pub struct LevenbergMarquardt<F> { /* private fields */ }
Expand description

Levenberg-Marquardt optimization algorithm.

See the module documentation for a usage example.

The runtime and termination behavior can be controlled by various hyperparameters.

Implementations

Set the relative error desired in the objective function $f$.

Termination occurs when both the actual and predicted relative reductions for $f$ are at most ftol.

Panics

Panics if $\mathtt{ftol} < 0$.

Set relative error between last two approximations.

Termination occurs when the relative error between two consecutive iterates is at most xtol.

Panics

Panics if $\mathtt{xtol} < 0$.

Set orthogonality desired between the residual vector and its derivative.

Termination occurs when the cosine of the angle between the residual vector $\vec{r}$ and any column of the Jacobian $\mathbf{J}$ is at most gtol in absolute value.

With other words, the algorithm will terminate if

  \cos\bigl(\sphericalangle (\mathbf{J}\vec{e}_i, \vec{r})\bigr) =
  \frac{|(\mathbf{J}^\top \vec{r})_i|}{\|\mathbf{J}\vec{e}_i\|\|\vec{r}\|} \leq \texttt{gtol}
  \quad\text{for all }i=1,\ldots,n.

This is based on the fact that those vectors are orthognal near the optimum (gradient is zero). The angle check is scale invariant, whereas checking that $\nabla f(\vec{x})\approx \vec{0}$ is not.

Panics

Panics if $\mathtt{gtol} < 0$.

Shortcut to set tol as in MINPACK LMDER1.

Sets ftol = xtol = tol and gtol = 0.

Panics

Panics if $\mathtt{tol} \leq 0$.

Set factor for the initial step bound.

This bound is set to $\mathtt{stepbound}\cdot\|\mathbf{D}\vec{x}\|$ if nonzero, or else to stepbound itself. In most cases stepbound should lie in the interval $[0.1,100]$.

Panics

Panics if $\mathtt{stepbound} \leq 0$.

Set factor for the maximal number of function evaluations.

The maximal number of function evaluations is set to $\texttt{patience}\cdot(n + 1)$.

Panics

Panics if $\mathtt{patience} \leq 0$.

Enable or disable whether the variables will be rescaled internally.

Try to solve the given least squares problem.

The paramters of the problem which are set when this function is called are used as the initial guess for $\vec{x}$.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.