cminpack |
index |
Nonlinear Least Squares
Minimize arbitrary function of list-like object x, J=|f(x)|^2, where f
returns a list-like object.
Function:
leastsq(f,
x,
funcArgs=[],
tol=1e-8)
tol specifies the goodness of fit. The function exists
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.
funcArgs specifies an extra arguments required to function f. I.e. f
can have a call signature of
f(x,funcArgs[0], ...)
The return value of leastsq is a dictionary with the following keys:
"info" - an integer giving the function exit status. Normal exit
status is given by values of 1-3. Possible values are:
0 Improper input parameters.
1 Algorithm estimates that the relative error in the
sum of squares is at most TOL.
2 Algorithm estimates that the relative error between
X and the solution is at most TOL.
3 Conditions for INFO = 1 and INFO = 2 both hold.
4 FVEC is orthogonal to the columns of the Jacobian t
machine precision.
5 Number of calls to FCN has reached or exceeded
200*(N+1).
6 TOL is too small. No further reduction in the sum
of squares is possible.
7 TOL is too small. No further improvement in the
approximate solution X is possible.
"x" - the value of x which minimizes J.
"fx" - the value of f(x) at the optimal value of x.
This function calls the lmdif1 function from the cminpack library
(http://devernay.free.fr/hacks/cminpack.html) which uses a modified
Levenberg-Marquardt algorithm. cminpack is based on minpack
(http://www.netlib.org/minpack/index.html)
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
Functions | ||
|