ContentTop, Main, Index
This package provides tcl wrapper for optimization procedures. The sources of procedures are:
Installation and dependenciesTop, Main, Index
For building you need:
For run you also need:
To build run
./configure make sudo make install
If you have different versions of Tcl on the same machine, you can set the path to this version with -with-tcl=path
flag to configure script.
For Windows build it is strongly recommended to use MSYS64 UCRT64 environment, the above steps are identical if you run it from UCRT64 shell.
Supported platformsTop, Main, Index
I've tested it on:
- Kubuntu 24.04 with Tcl 9 and Tcl 8.6.15
- Windows 11 in MSYS64 UCRT64 environment with Tcl9
DocumentationTop, Main, Index
You can find some documentation here
Interactive helpTop, Main, Index
All public methods have interactive help. To get information about method (including new
and create
) and its arguments call it with -help
switch:
package require tclopt namespace import ::tclopt::* Mpfit new -help
Creates optimization object that does least squares fitting using modified Levenberg-Marquardt algorithm. For more detailed description please see documentation. Can accepts unambiguous prefixes instead of switches names. Accepts switches only before parameters. Switches: -funct value - Required. Name of the procedure that should be minimized. -m value - Required. Number of data points. -pdata value - List or dictionary that provides private data to funct that is needed to evaluate residuals. Usually it contains x and y values lists, but you can provide any data necessary for function residuals evaluation. Will be passed upon each function evaluation without modification. Default value is . -ftol value - Control termination of mpfit. Termination occurs when both the actual and predicted relative reductions in the sum of squares are at most ftol. Default value is 1e-10. -xtol value - Control termination of mpfit. Termination occurs when the relative error between two consecutive iterates is at most xtol. Default value is 1e-10. -gtol value - Control termination of mpfit. Termination occurs when the cosine of the angle between fvec and any column of the jacobian is at most gtol in absolute value. Default value is 1e-10. -stepfactor value - Used in determining the initial step bound. This bound is set to the product of factor and the euclidean norm of diag*x if nonzero, or else to factor itself. Default value is 100. -covtol value - Range tolerance for covariance calculation. Default value is 1e-14. -maxiter value - Maximum number of iterations. Default value is 200. -maxfev value - Control termination of mpfit. Termination occurs when the number of calls to funct is at least maxfev by the end of an iteration. If it equals to 0, number of evaluations is not restricted. Default value is 0. -epsfcn value - Finite derivative step size. Default value is 2.2204460e-16. -nofinitecheck - Boolean. Enable check for infinite quantities. -help - Help switch, when provided, forces ignoring all other switches and parameters, prints the help message to stdout, and returns up to 2 levels above the current level.
Best to do it in interactive console, see tkcon