NLFitLevenbergMarquardtFit(NLFitLMFunction, Double, Double, Double, Int32, Int32, Double, Double, Int32, Double, Double, Double, Double, Double, CancellationToken) Method |
Minimizes the sum of squares of m nonlinear functions in n variables using the Levenberg-Marquardt algorithm,
using caller-provided work arrays.
Namespace: Altaxo.Calc.RegressionAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntaxpublic static void LevenbergMarquardtFit(
NLFitLMFunction fcn,
double[] xvec,
double[] fvec,
double tol,
ref int info,
int[] iwa,
double[] diag,
double[] fjac,
int[] ipvt,
double[] qtf,
double[] wa1,
double[] wa2,
double[] wa3,
double[] wa4,
CancellationToken cancellationToken
)
Parameters
- fcn NLFitLMFunction
- The user-supplied function that provides values to minimize.
- xvec Double
-
Array of length n containing the parameter vector. On input, it must contain an initial estimate of the solution.
On output, it contains the final estimate of the solution.
- fvec Double
- Output array of length m which receives the function values evaluated at the output xvec.
- 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 xvec and the solution is at most tol.
- 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.
- iwa Int32
- Integer working array of length n.
- diag Double
- Working array of length n. If mode = 2 in the general interface, contains scaling factors.
- fjac Double
- Working array for the Jacobian of length m*n (column-major).
- ipvt Int32
- Working array of length n containing pivot indices.
- qtf Double
- Working array of length n containing the first n elements of (Qᵀ)f.
- wa1 Double
- Working array of length n.
- wa2 Double
- Working array of length n.
- wa3 Double
- Working array of length n.
- wa4 Double
- Working array of length m.
- cancellationToken CancellationToken
- Token to cancel the fit.
Remarks
This is an easy-to-use interface with explicit auxiliary storage allocation.
If you need full control over the minimization process and auxiliary storage, use the most general interface.
See Also