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

Home » Public Forums » archive » write more efficient for loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
write more efficient for loop [message #91632] Fri, 07 August 2015 06:25 Go to previous message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hi

I used the Profiler, /SYSTEM & Profiler to identify which part of the code takes long time. I am using nested for loop (takes about 1950 sec).

N = 215L

Image_2 = make_array(N,N,/double)

for i=0L, N-1 do begin
for j=0L, N-1 do begin
x = round(i + A[i, j])
y = round(j + B[i, j])
if (x ge 0) && (y ge 0) then begin
Image_2[i,j] = Image_1[x, y]
endif
endfor
endfor

I was wondering if there is a more efficient way to write the above. I don't have a lot of experience in programming.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: an urgent help of file conversio
Next Topic: rot and poly_2d question

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

Current Time: Wed Oct 08 13:58:30 PDT 2025

Total time taken to generate the page: 0.00362 seconds