Click or drag to resize

NLFitLevenbergMarquardtFit(NLFitLMFunction, Double, Double, Double, CancellationToken, Int32) Method

The purpose of LevenbergMarquardtFit is to minimize the sum of the squares of m nonlinear functions in n variables by a modification of the Levenberg-Marquardt algorithm. This is done by using the more general least-squares solver below. The user must provide a subroutine which calculates the functions. The Jacobian is then calculated by a forward-difference approximation.

Namespace: Altaxo.Calc.Regression
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static void LevenbergMarquardtFit(
	NLFitLMFunction fcn,
	double[] xvec,
	double[] fvec,
	double tol,
	CancellationToken cancellationToken,
	ref int info
)

Parameters

fcn  NLFitLMFunction
The user supplied function which provides the values to minimize.
xvec  Double
Array of length n containing the parameter vector. On input x must contain an initial estimate of the solution vector. On output x contains the final estimate of the solution vector.
fvec  Double
Output array of length m which contains the functions evaluated at the output x.
tol  Double
Nonnegative input variable. Termination occurs when the algorithm estimates either that the relative error in the sum of squares is at most tol or that the relative error between x and the solution is at most tol.
cancellationToken  CancellationToken
Token to cancel the fit.
info  Int32
Info is an integer output variable. If the user has terminated execution, info is set to the (negative) value of iflag. See description of fcn. Otherwise, info is set as follows: info = 0 improper input parameters. info = 1 algorithm estimates that the relative error in the sum of squares is at most tol. info = 2 algorithm estimates that the relative error between x and the solution is at most tol. info = 3 conditions for info = 1 and info = 2 both hold. info = 4 fvec is orthogonal to the columns of the Jacobian to machine precision. info = 5 number of calls to fcn has reached or exceeded 200*(n+1). info = 6 tol is too small. No further reduction in the sum of squares is possible. info = 7 tol is too small. No further improvement in the approximate solution x is possible.
Remarks
This is the most easy-to-use interface with the smallest number of arguments. If you need more control over the minimization process and auxilliary storage allocation you should use one of the interfaces described below.
See Also