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

Home » Public Forums » archive » Re: Vectorize procedure
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: Vectorize procedure [message #69164 is a reply to message #68971] Thu, 10 December 2009 12:00 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<b599bcdf-d42e-45d8-b643-7ea4620fd7ed@k19g2000yqc.googlegroups.com>,
Romolo Politi <romolo.politi@gmail.com> wrote:

> Sorry for the not clarity.
> my situation is
> x=fltarr(3200,201,201)
> y=fltarr(3200,201,201)
> newx=fltarr(799,201,201)
> newy=fltarr(799,201,201)
> for i=0,200 do begin
> for j=0,200 do begin
> newy[*,i,j]=interpol(y[*,i,j],x[*,i,j],newx[*,i,j],/SPLine)
> endfor
> endfor

You are doing ~40,000 separate spline fits. I don't think there is
any way to vectorize this, as each fit is an independent problem.
Spline fitting is a coupled problem, so you cannot, for example, simply
string your segments together into one long fit.

If the newx[*,i,j] are the same for all i and j, you can probably get
a significant speed-up by calling SPL_INIT once and then calling
SPL_INTERP for each i and j. Since you are storing newx separately
for each i and j, I gather this is not the case.

Your program is accessing memory efficiently, but you will get a small
speed up by saying

newy[0,i,j]=interpol(y[*,i,j],x[*,i,j],newx[*,i,j],/SPLine)

You might also try the other built in spline functions: SPLINE,
SPLINE_P, SPL_INIT and SPL_INTERP to see whether one is faster.

Finally, I notice that you are downsampling your data substantially.
Are you sure you really need to use a spline fit to do that?

Ken Bowman
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: WCS Coordinates not kept with WRITEFITS
Next Topic: ftp put file on windows using IDL

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

Current Time: Fri Oct 10 09:28:08 PDT 2025

Total time taken to generate the page: 1.16068 seconds