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

Home » Public Forums » archive » Re: Maximum index for arrays?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Maximum index for arrays? [message #62559] Mon, 15 September 2008 06:38
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
hotplainrice@gmail.com wrote:
> Hi guys,
>
> Thanks for helping me for the past few weeks. I've managed to get
> CUBLAS and other CUDA programs working in IDL. What I have now for you
> guys is this.
>
> Here is the code
>
> N = 181
> N2 = N^2
> a = fltarr(N2, 141)
> help,a
>
> A FLOAT = Array[32761, 141]
>
> N = 182
> N2 = N^2
> a = fltarr(N2, 141)
> % Array dimensions must be greater than 0
> % Execution halted at: TEST 5 /home/hpr/test.pro
> % $MAIN$
> IDL>
>
> How big can the index go? Its because I need N = 100 to 1000

Just for the records, IDL 32-bit can have arrays with a maximum of
about
2^31/N elements, where N is the size in byte of one element (i.e. 1
for bytes,
2 for int, 4 for long int and floats, etc. etc.).

On the orther hand, IDL 64 bits can (in principle) allocate arrays so
large that you won't be able to store them anyway (at least for the
next
few years or so)

Cheers,
Paolo


>
> Regards
> Zaki
Re: Maximum index for arrays? [message #62562 is a reply to message #62559] Mon, 15 September 2008 03:15 Go to previous message
hotplainrice@gmail.co is currently offline  hotplainrice@gmail.co
Messages: 15
Registered: July 2008
Junior Member
On Sep 15, 6:53 pm, Chris <beaum...@ifa.hawaii.edu> wrote:
> On Sep 14, 8:08 pm, "hotplainr...@gmail.com" <hotplainr...@gmail.com>
> wrote:
>
>
>
>> Hi guys,
>
>> Thanks for helping me for the past few weeks. I've managed to get
>> CUBLAS and other CUDA programs working in IDL. What I have now for you
>> guys is this.
>
>> Here is the code
>
>> N = 181
>> N2 = N^2
>> a  = fltarr(N2, 141)
>> help,a
>
>> A                     FLOAT         = Array[32761, 141]
>
>> N = 182
>> N2 = N^2
>> a = fltarr(N2, 141)
>> % Array dimensions must be greater than 0
>> % Execution halted at: TEST                      5 /home/hpr/test.pro
>> %                   $MAIN$
>> IDL>
>
>> How big can the index go? Its because I need N = 100 to 1000
>
>> Regards
>> Zaki
>
> The problem is that the line
> N = 182
> sets N to a 16-bit signed integer (max size 32767-ish). When you
> square it (33124), it overflows and becomes negative (-32412). Use
> something like
> N=182L (long integer with max size about 2 billion) or
> N=2. (floating point)
>
> As long as you have the RAM, arrays can have millions or billions (i
> think) of elements, so you'll be fine.
>
> chris

Thanks chris, that resolved the problem.
Re: Maximum index for arrays? [message #62565 is a reply to message #62562] Mon, 15 September 2008 01:53 Go to previous message
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Sep 14, 8:08 pm, "hotplainr...@gmail.com" <hotplainr...@gmail.com>
wrote:
> Hi guys,
>
> Thanks for helping me for the past few weeks. I've managed to get
> CUBLAS and other CUDA programs working in IDL. What I have now for you
> guys is this.
>
> Here is the code
>
> N = 181
> N2 = N^2
> a  = fltarr(N2, 141)
> help,a
>
> A                     FLOAT         = Array[32761, 141]
>
> N = 182
> N2 = N^2
> a = fltarr(N2, 141)
> % Array dimensions must be greater than 0
> % Execution halted at: TEST                      5 /home/hpr/test.pro
> %                   $MAIN$
> IDL>
>
> How big can the index go? Its because I need N = 100 to 1000
>
> Regards
> Zaki

The problem is that the line
N = 182
sets N to a 16-bit signed integer (max size 32767-ish). When you
square it (33124), it overflows and becomes negative (-32412). Use
something like
N=182L (long integer with max size about 2 billion) or
N=2. (floating point)

As long as you have the RAM, arrays can have millions or billions (i
think) of elements, so you'll be fine.

chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How do I return a 2d array in a system routine?
Next Topic: IDL is not accurate enough!

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

Current Time: Fri Oct 10 10:06:51 PDT 2025

Total time taken to generate the page: 0.00824 seconds