Subject: [FFC-dev] Limitation in NumPy?

From: Anders Logg <[email-masked]>
Date: Fri, 25 May 2007 11:31:48 +0200

Does anyone know if there is a limitation in NumPy to 12 axes
for numpy.transpose?

Try the following code:

  import numpy

  n = 13
  shape = n*(1,)
  axes  = range(n)

  A = numpy.zeros(shape)
  A = numpy.transpose(A, axes)

It works for n = 12, but for n = 13 I get

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    A = numpy.transpose(A, axes)
  File "/usr/lib/python2.5/site-packages/numpy/core/fromnumeric.py",
  line 118, in transpose
    return transpose(axes)
ValueError: dimensions too large.

/Anders

---

From: Anders Logg <[email-masked]>
Date: Fri, 25 May 2007 11:41:16 +0200

I have version 1.0.1 (1.0.1-8ubuntu1).

Do you know why there is a limitation on n?

/Anders

On Fri, May 25, 2007 at 11:39:36AM +0200, Pearu Peterson wrote:
> What numpy version do you use? With numpy 1.0.3 there is
> limit to n and that is 32. You would get error with numpy.zeros(shape)
> if n>32.
> 
> Regards,
> Pearu
> 
> Anders Logg wrote:

---

From: Anders Logg <[email-masked]>
Date: Fri, 25 May 2007 12:54:57 +0200

On Fri, May 25, 2007 at 12:01:01PM +0200, Pearu Peterson wrote:
> Yes, there are several places where array dimensions
> are allocated statically (for performance reasons)
> and there must be some limit defined. You can
> redefine this limit in numpy/core/include/numpy/ndarrayobject.h
> file, look for the definition of NPY_MAXDIMS (and NPY_MAXARGS),
> before rebuilding numpy.
> 
> Pearu

ok, great. Thanks for the info!

/Anders