[Numpy-discussion] ValueError: dimensions too large.

Charles R Harris charlesr.harris@gmail....
Wed May 6 09:32:35 CDT 2009


On Wed, May 6, 2009 at 8:18 AM, natachai wongchavalidkul <
natachai_w@hotmail.com> wrote:

>
> Hello alls,
>
> I currently have a problem with creating a multi-dimensional array in
> numpy. The following is what I am trying to do and the error message.
>
> >>> test = zeros((3,3,3,3,3,3,10,4,6,2,18,10,11,4,2,2), dtype=float);
>
> Traceback (most recent call last):
> File "<pyshell#39>", line 1, in <module>
> test = zeros((3,3,3,3,3,3,10,4,6,2,18,10,11,4,2,2), dtype=float);
> ValueError: dimensions too large.
>
> I haven't sure if they should be something to do with the memory or any
> other suggestions for the way to solve this problem. Anyway, comments or
> suggestions will be really appreciate though.
>

There is not enough memory to hold the array.

In [3]: prod = 1

In [4]: for i in (3,3,3,3,3,3,10,4,6,2,18,10,11,4,2,2) :
   ...:     prod *= i
   ...:

In [5]: prod
Out[5]: 11085465600L

That is 11 gigs of floats, each of which is 8 bytes. So you need about 88
gigs for the array. I expect that that is not what you are trying to do. Do
you just want an array with the listed values?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090506/20d58c14/attachment.html 


More information about the Numpy-discussion mailing list