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

Home » Public Forums » archive » faster minimization needed - maybe mpfit?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: faster minimization needed - maybe mpfit? [message #79737 is a reply to message #79653] Mon, 26 March 2012 12:59 Go to previous messageGo to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 26 Mrz., 21:04, Craig Markwardt <craig.markwa...@gmail.com> wrote:
> On Monday, March 26, 2012 9:15:30 AM UTC-4, chris wrote:
>> Hi folks,
>> the following expression runs successfully with AMOEBA but requires
>> for large matrices (columns < 512, rows up to 30000), for small
>> tolerances (e.g. ftol=1e-06) and a high number of iterations
>> (nmax>=10000) to converge years:
>
>> expr = total(abs(convol(im-rebin(p[*],size(im,/dim),/samp),
>> [-1.,0.,1.])))
>
>> where p is the parameter vector (one row) to be found and im is the
>> matrix.
>
>> Is there a way to do it faster? Maybe with mpfit (I don't get an idea
>> how...)
>
> If you can express your problem as minimize{TOTAL(RESID^2)}, then you can use MPFIT, where RESID is signed.  In your case you can do this, but there's a few little tricks.
>
> Your problem looks like minimize{TOTAL(ABS(XXX))}.
>
> You might want to define RESID=SQRT(ABS(XXX)), and then in principle it looks like an MPFIT problem.  Unfortunately you need to preserve the sign of XXX.  So this is what you do:
>   RESID = SIGN(XXX)*SQRT(ABS(XXX))
> where SIGN(XXX) is the sign of XXX (-1 or +1 depending on XXX).
>
> Happy equation solving...
> Craig

Hi Craig,
thank you. Nevertheless, I don't think that I understood what you
suggests. So, i tried this:

function test2,p,x=x,err=err
temp=convol(x,rebin(p[*],size(x,/dim)))
return,signum(temp)*sqrt(abs(temp))
end

But what I got is this:

ENVI> st={x:im}&help,mpfit('test2',functargs=st,maxiter=100)
<Expression> DOUBLE = NaN

What's wrong?

Thank you

Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cellular automata
Next Topic: IDL and PV wave language free

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

Current Time: Wed Oct 08 16:06:44 PDT 2025

Total time taken to generate the page: 0.00410 seconds