[SciPy-User] scipy.optimize lmder_ and dlopen / dlsym

Sebastian Haase seb.haase at gmail.com
Tue Jan 18 10:38:14 EST 2011


Hi,
I was trying to do some 2d Gaussian fitting on my image data using
scipy.optimize.leastsq.
This worked, but it still takes about 1ms for fitting sigma and
peakHeight on a 7x7 pixel image area.
So I'm thinking about speeding things up:
Writing the objective function and the Jacobian in C (I like using
SWIG) would be one thing.
But I'm also thinking that for such small problems, the overhead of
function calls back and forth in Python (for each parameter set
evaluation) would be problematic.

So my question is:
Can I access the underlying lmder_ function (which is normally called
from leastsq via minpack [ _minpackmodule.c ])
directly from my SWIGged extenstion module ?

I'm thinking of LoadLibrary (win32) and dlopen/dlsym (linux) ...

The advantage would be that I would _not_ have to find another C
implementation of Levenberg-Marquardt.
I found http://www.ics.forth.gr/~lourakis/levmar/index.html, but that
didn't even compile on debian and would be another dependency.

Thanks,
Sebastian Haase



More information about the SciPy-User mailing list