comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » mpfit and analytical derivative debugging
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
mpfit and analytical derivative debugging [message #80079] Tue, 08 May 2012 06:04
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
I have this fitting problem that I'm solving with mpfit. The code works but the function values are kind of costly to calculate and the penalty for calculating the analytical derivatives once you have calculated the function value is relatively small. So I'm trying to use the AUTODERIVATIVE=0 setting.

I've tested my analytical derivatives against numerical derivatives in a standalone program that does not involve mpfit. Looks fine.

However, there seems to be something wrong because the problem does not converge anymore. (The solution does not change significantly from one iteration to the next.) Most likely an order of magnitude problem because the problem does not go away when I change the sign of the derivatives. (Or something more fundamental that I've misunderstood.)

So I'm setting

parinfo[iparam].mpderiv_debug = 1
parinfo[iparam].mpderiv_reltol = 1d-3
parinfo[iparam].mpderiv_abstol = 1d-7

for all parameters, expecting screen output of this sort (from doc header of mpfit.pro):

; FJAC DEBUG BEGIN
; # IPNT FUNC DERIV_U DERIV_N DIFF_ABS DIFF_REL
; FJAC PARM 2
; 80 -0.7308 0.04233 0.04233 -5.543E-07 -1.309E-05
; 99 1.370 0.01417 0.01417 -5.518E-07 -3.895E-05
; 118 0.07187 -0.01400 -0.01400 -5.566E-07 3.977E-05
; 137 1.844 -0.04216 -0.04216 -5.589E-07 1.326E-05
; FJAC DEBUG END

But what I get looks like this:


FJAC DEBUG BEGIN
# IPNT FUNC DERIV_U DERIV_N DIFF_ABS DIFF_REL
# FJAC_MASK = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
analytical derivatives
Iter 1 -- CHI-SQUARE = 328.57185 -- DOF = 65515



The "analytical derivatives" line is just a printout from my MYFUNC indicating that it has entered the part where the analytical derivatives are calculated. I don't know how to interpret FJAC_MASK and the "Iter 1..." line shows that mpfit thinks it is done with this iteration.

Suggestions?

/Mats
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Arrow and vectors
Next Topic: Update on New Career

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:38:30 PDT 2025

Total time taken to generate the page: 0.02802 seconds