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

Home » Public Forums » archive » Re: for loop elimination
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 loop elimination [message #56201] Mon, 15 October 2007 15:48 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
jtmcahill@gmail.com wrote:

> Hello,
>
> I have been trying without success to get this simple calculation to
> be done without using a loop. Here it is:
>
> for y2=0L,n2-1 do e_sc[0,y2]=max(abs(sc_arr[*,y2]-model_sc[12:bands
> +11,y2]))
>
> Can I use the max function without and get an array of outputs without
> having to do them one at a time. To put this into context, I have a
> program that this piece of code is in and the program is taking too
> long to compute. I'm figuring I start with eliminating for loops and
> go from there to make it more efficient. Any ideas on this piece?
>
> Hawaiianite


Hi,

MAX() can get a dimension keyword... the help file is pretty straight
forward and contains examples!

Now you can also vectorize the subtraction!

Jean
[Message index]
 
Read Message
Read Message
Previous Topic: How to read file to fill an array "partially" ?
Next Topic: making polygon on top of image in IDL

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

Current Time: Sat Oct 11 08:31:40 PDT 2025

Total time taken to generate the page: 1.44027 seconds