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

Home » Public Forums » archive » Re: Subscripting multidimensional arrays
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: Subscripting multidimensional arrays [message #37269] Fri, 12 December 2003 13:35 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 12 Dec 2003 14:15:33 -0700, Christopher Lee wrote:

> JD Smith wrote:
>> On Fri, 12 Dec 2003 07:55:16 -0700, Christopher Lee wrote:
> <snip>
>>
>> PRODUCT works nicely for this:
>>
>> function linear_indices,array,vec_indices
>> s=size(array,/DIMENSIONS)
>> nd=n_elements(s)
>> if nd eq 1 then return,s[0]
>
> ;you mean "return ,vec_indices" , yes?

Whoops, yes, sorry:

if nd eq 1 then return, vec_indices[0]

>> return,long(total([1.,product(s[0:nd-1],/CUMULATIVE)]*vec_in dices))
>> end
>
> PRODUCT doesn't seem to exist on my IDL installations (5.3->5.6
> inclusive), is it an IDL 6 thing? I've written my own obviously, but not
> with CUMULATIVE. Hopefully the IDL 6 licence will work on Monday.>

Strange, it shipped with IDL5.6.

>
>
>> to go the other direction, IDL6 offers ARRAY_INDICES. Or you can
>> always just resort to:
>>
>> a[vec[0],vec[1],vec[2]]
>>
>>
> Ahem, oops. Apparently I used a cluster bomb to open a can of beans...a
> switch case statement would take care of the dimensions upto the IDL
> limit of 8 dimensions, or using IDL's ability to ignore trailing
> dimensions if they're 0 hack to use 8 dimensions every time.

Yes, but that would be ugly ;). What if IDL increases the 8-dim limit in
the future?

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: rebinning data on new time samples without loops?
Next Topic: Re: 2D FFT Slow. Any ideas? fft2()

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

Current Time: Fri Oct 10 04:17:30 PDT 2025

Total time taken to generate the page: 0.95685 seconds