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 #79801 is a reply to message #79722] Wed, 28 March 2012 23:45 Go to previous messageGo to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 27 Mrz., 15:38, Craig Markwardt <craig.markwa...@gmail.com> wrote:
> On Tuesday, March 27, 2012 8:28:02 AM UTC-4, chris wrote:
>> Hi Craig,
>> sorry I made several typos. I would also be satisfied with a least
>> squares solution as you can see if you compare function test2 with the
>> previous posts. The function I want to minimize is test2. It doesnt
>> matter for me at this stage whether total(abs(resid)) or
>> total(resid^2) is minimized.
>
>> function test2,p,xval=x,errval=err
>> resid=convol(x-rebin(p[*],size(x,/dim)),[-1.,0.,1.])
>> return,total(resid^2)
>> end
>
>> ENVI> help,im
>> IM              INT       = Array[512, 7237]
>> ENVI> sz=size(im,/dim)
>> ENVI> im2=im+fix(1000.*rebin((((add=randomn(seed,sz[0])))-mean(add ))/
>> stddev(add),sz))
>> ENVI> help,im2
>> IM2             INT       = Array[512, 7237]
>> ENVI> p0=((p0=total(im2,2)/float(sz[1])))-smooth(p0,3,/edge_trunc)
>> ENVI> help,p0
>> P0              FLOAT     = Array[512]
>> ENVI> st={x:im2,errval:sqrt(p0)}
>> &res=mpfit('test2',p0,functargs=st,maxiter=100,status=st atus,errmsg=errmsg)
>> &print,status,string(10b),errmsg
>>            0
>> ERROR: number of parameters must not exceed data
>
> Check out the documentation for MPFIT.  It expects your user function to return a 1D array of residuals, not the sum of squares.
>
> Craig

Dear Craig,
now it works perfect. Thank you!

CR
[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 18:11:41 PDT 2025

Total time taken to generate the page: 0.00526 seconds