[SciPy-dev] lmder patch

Andy Jennings scipy2mdjhs78c@jenningsstory....
Wed Apr 11 12:19:54 CDT 2007

optimize.leastsq is not converging when I use a jacobian function.

MATRIXC2F is transposing the wrong way.  Below is a patch that fixes it in
jac_multipack_lm_function, but I'm not sure this is the right fix.  It looks
like jac_multipack_calling_function might have the same problem, in which
case maybe it's better to fix the definition of MATRIXC2F in
Lib/optimize/minpack.h.  I guess I would want a test case for hybrj to be

Lib/integrate/multipack.h and Lib/interpolate/multipack.h also define a
MATRIXC2F macro.  I have no idea if they need to be looked at as well.


P.S. I just signed up for a trac account a few days ago.  I have to submit
patches to someone with the rights to commit, right?  Is this scipy-dev list
the best place to do it?

Index: Lib/optimize/__minpack.h
--- Lib/optimize/__minpack.h    (revision 2901)
+++ Lib/optimize/__minpack.h    (working copy)
@@ -149,7 +149,7 @@
       return -1;
     if (multipack_jac_transpose == 1)
-      MATRIXC2F(fjac, result_array->data, *n, *ldfjac)
+      MATRIXC2F(fjac, result_array->data, *ldfjac, *n)
       memcpy(fjac, result_array->data, (*n)*(*ldfjac)*sizeof(double));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20070411/0c4a5da6/attachment.html 

More information about the Scipy-dev mailing list