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

Home » Public Forums » archive » Re: another request for help with getting rid of for loops...
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: another request for help with getting rid of for loops... [message #49762 is a reply to message #49752] Tue, 15 August 2006 07:18 Go to previous messageGo to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
davede10@gmail.com wrote:
> Hi everyone,
> i read alot about eliminating for loops in idl , and yet i can't get
> rid of this simple loop .
> here is what i'm trying to do (multiply each plane in a data cube by a
> number):
> any idea?
>
> A=fltarr(100,100,10) ;my data cube
> A(*,*,*)=1.
> b=findgen(10) ;just a culumn of numbers
> c=a
> for i=0.9 do c(*,*,i)=A(*,*,i)*B(i)

a = findgen(100,100,10)
b = findgen(10)
c = transpose(rebin(b, 10, 100, 100, /sample))
c = a*c

(Using findgen makes it easier to verify the result by searching the
old and new method for differences).

Maarten
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: functions to access ETOPO2 or other bathymetric data sets?
Next Topic: Can these nested loops be made to run faster?

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

Current Time: Wed Oct 08 17:34:03 PDT 2025

Total time taken to generate the page: 0.00468 seconds