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

Home » Public Forums » archive » improve calculation time
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
improve calculation time [message #88959] Tue, 08 July 2014 11:29 Go to previous message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hello

I am trying to improve my code in order to make it faster. A part of my code is the following

DIM = make_array(301,301,/DOUBLE)
pval = 0

for i=0, 300 do begin
for j=0, 300 do begin
x = round(i + Bx[i, j])
y = round(j + By[i, j])
if (x lt 301) && (y lt 301) && (x ge 0) && (y ge 0) then begin
DIM[i,j] = SIM[x, y]
endif
pval= pval + (DIM[i,j] - TIM[i, j])^2.
endfor
endfor

Because I repeat the above procedure a lot of times it takes time to run. I noticed that the DIM array it's creating in every single iteration and I supposed that it takes time. I was wondering if I can write it in a different way in order to overwrite it in each iteration instead of delete it and create it all the time. To overwrite it I need to add it into the loop?

Regards,
Gina
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Comparison between arrays with different lenght
Next Topic: No Raster Image via Imagemagick

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

Current Time: Wed Oct 08 15:08:04 PDT 2025

Total time taken to generate the page: 0.00372 seconds