Re: 9 dimensions arrays [message #41860] |
Mon, 06 December 2004 21:09 |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <MPG.1c1eb6cc10c06fca98989b@news.frii.com>,
David Fanning <davidf@dfanning.com> wrote:
> Francois writes:
>
>> How to create nine dimensions (9D) arrays ?
>>
>> The command make_array takes only 8 dimensions...
>> It seems the same for intarr, fltarr, etc.
>
> That's right. Eight is the limit in IDL.
Well, you could make your own n-dimensional arrays by using
one-dimensional arrays and writing your own subscripting function, e.g.,
dims = [n1, n2, n3, n4, n5, n6, n7, n8, n9]
x = FLTARR(PRODUCT(dims))
x[MY_INDEX(i1, i2, i3, i4, i5, i6, i7, i8, i9, DIMS = dims)] = ...
The MY_INDEX function would convert from subscripts to 1-D array index
(what IDL does for normal subscripts internally).
Of course, it wouldn't be particularly fast. ;-)
Ken Bowman
|
|
|
Re: 9 dimensions arrays [message #41862 is a reply to message #41860] |
Mon, 06 December 2004 19:51  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield writes:
> And I am proud to report that I once wrote some code in which it would
> have been desirable to create arrays with 9 or 10 dimensions. I had to
> work around the limit by merging a few of them.
I *thought* about a 4D array once, but decided against it after
reading the Array Concatenation Tutorial again. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: 9 dimensions arrays [message #41864 is a reply to message #41862] |
Mon, 06 December 2004 19:45  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
David Fanning wrote:
> Francois writes:
>
>
>> How to create nine dimensions (9D) arrays ?
>>
>> The command make_array takes only 8 dimensions...
>> It seems the same for intarr, fltarr, etc.
>
>
> That's right. Eight is the limit in IDL.
And I am proud to report that I once wrote some code in which it would
have been desirable to create arrays with 9 or 10 dimensions. I had to
work around the limit by merging a few of them.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
Re: 9 dimensions arrays [message #41866 is a reply to message #41864] |
Mon, 06 December 2004 17:35  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Francois writes:
> How to create nine dimensions (9D) arrays ?
>
> The command make_array takes only 8 dimensions...
> It seems the same for intarr, fltarr, etc.
That's right. Eight is the limit in IDL.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|