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 #89541 is a reply to message #89540] Fri, 24 October 2014 07:49 Go to previous messageGo to previous message
rryan%stsci.edu is currently offline  rryan%stsci.edu
Messages: 16
Registered: October 2014
Junior Member
Unfortunately, I am unaware of a better way of doing arithmetic of the form

Matrix _DO_SOMETHING_HERE_ vector

where the vector is applied to all the rows/columns of the matrix without looping or beefing up the vector to match the matrix.

Two more things. First a question. How huge is HUGE? What are the real dimensions of the 2 matrices and vectors. Also, do you really need them both in memory? Like, do you need all the past time values in memory at this time?

Second a statement. If the answer is Yes, i need everything at all times. Then doing

a= x# make_array()

is going to be slow. Because the # operator is doing arthimeic. You'll likely be better off using rebin and reform to achieve the same goal.

-Russell



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.
>
> The other thing I thought about was taking the timezero array and changing it into a 2D array of the correct dimensions, e.g.
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
>
> timedistancearray =FINDGEN(3,3)
>
> timezero = timedistancearray(*,0)#MAKE_ARRAY(1, 3, /DOUBLE, VALUE = 1D0)
>
> timedistance_minustimezero = timedistancearray-timezero
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;
>
> But again, this perhaps isn't ideal as it will involve creating an equally huge array to do the operation which will have add to the memory overhead.
>
> I keep hearing that if you want to get good at IDL you have to exploit the array operations properly - what other options do I have here?
>
> Thanks in advance
>
> Jonathan
[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 18:57:10 PDT 2025

Total time taken to generate the page: 0.00364 seconds