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

Home » Public Forums » archive » Re: FOR loops removal
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: FOR loops removal [message #61972 is a reply to message #61971] Tue, 19 August 2008 06:43 Go to previous messageGo to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Tue, 19 Aug 2008 05:38:50 -0700 (PDT), loebasboy
<stijn.vdl@gmail.com> wrote:

> FOR l = 0, n*2 DO BEGIN
> temp = 0
> FOR i =0,max_y-1 DO BEGIN
> FOR j=0,max_x-1 DO BEGIN
> jtemp = j + l
> jtemp2 = j + n
> temp = temp + (arr[i,jtemp] * arr [i,jtemp2])
> ENDFOR
> ENDFOR
> output[l] = temp/(max_x*max_y)
> ENDFOR


The code below is a start. Does this processing have a name? It feels
familiar somehow. Btw, in IDL the first index of an array is the
column and the second is the row. So in your case y are the columns
and x are the rows. No problem with that off course, just check
whether this is how you intended it.

n = 8
max_x = 5
max_y = 5
output = fltarr(2*n+1)
arr = findgen(max_y, 2*n+max_x) +1

arr2=arr[0:max_y-1,n:max_x-1+n]
FOR l = 0, 2*n DO $
output[l] = total(arr[0:max_y-1,l:max_x-1+l]*arr2)
output/=max_x*max_y
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Today's IDL Lesson
Next Topic: speed of accessing different dimensions

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

Current Time: Sat Oct 11 08:58:41 PDT 2025

Total time taken to generate the page: 0.24023 seconds