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

Home » Public Forums » archive » IDL Way to have a single row/collum act on all rows/collums in an array
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: IDL Way to have a single row/collum act on all rows/collums in an array [message #89542 is a reply to message #89540] Fri, 24 October 2014 08:11 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Friday, October 24, 2014 10:32:43 AM UTC-4, JTMHD wrote:
> Hi Guys,
>
>
> What I am trying to do is analogous to the following
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> timedistancearray =FINDGEN(3,3)
>
> timezero = timedistancearray(*,0)
>
> timedistance_minustimezero = FLTARR(3,3)
>
> FOR t=0,2 DO timedistance_minustimezero(*,t)=timedistancearray(*,t)-timez ero
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> The thing is in this case the array is HUGE so I don't think the FOR loop would be optimum.

1. Looping over 1 dimension is usually fine. The important thing is to do many operations on each iteration, which you are doing in this case.

2. You want to rewrite the equation to avoid use of the asterisk on the left hand side

FOR t=0,2 DO timedistance_minustimezero[0,t]=timedistancearray[*,t]-timez ero

http://www.idlcoyote.com/code_tips/asterisk.html

3. As noted by Russell -- do you need to keep both arrays in memory? If not, then you can write it like this:

FOR t=0,2 DO timedistancearray[0,t]=timedistancearray[*,t]-timezero
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to choose the Language of IDL Workbench on mac os
Next Topic: rescaling draw widgets: is there an easier solution to this?

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

Current Time: Wed Oct 08 19:28:21 PDT 2025

Total time taken to generate the page: 0.00356 seconds