Some debian
packages of pdl modules:n

These distributions are also available on CPAN. The packages are only built for one architecture. Some of the distributions already had a ./debian directory. Otherwise, I added the ./debian directory myself.

- Levmar CPAN page .
- The levmar C library by Manolis Lourakis .

I frequently need to do non-linear fitting of data, and have never been satisfied with the tools I found. I want to work in a high-level, general numerical analysis framework. All I ask for is a powerful, convenient, robust, flexible, free, etc. implementation. The levmar library (which uses the lapack and blas libraries) is the only C library that I found that appears to be featureful (eg, box and linear constraints ), efficient (uses lapack and blas and has conditionals in the code to choose different methods depending on the size of matrices, etc.), well organized and easy to use, and free. I wrote this PDL module to try to fill the remaining requirements.

The fit function can be supplied as a perl function, or as a string containing a C function which is transparantly compiled and linked, in which case the the entire fit procedure is done in compiled C. (In some textbook optimization problems that have a small amount of data, but require a very large number of iterations to converge, this provides more than an order of magnitude increase in speed.) In addition, the perl module includes a very simple pre-processor language that is as fast as C, but much more concise. Here is an example that fits data arrays ($x,$t) to a gaussian

$result = levmar($params,$x,$t, FUNC => ' function x = p0 * exp(-t*t * p1); '); print $result->{P};

The hash $result contains the optimized parameters ( P ) and a lot of other information, such as the covariance matrix, and the values of all the quantities relevant to the stopping criteria. If levmar is given additional arguments specifying linear or box constraints or an analytic jacobian, or single or double precision arguments, the appropriate C algorithms are chosen transparantly. The implementation is designed to provide the simplest black box possible as well as maximum control if desired.

pylevmar python binding to levmar. It seems that this library is becoming popular ...

John Lapeyre's Home page