Emanuele Olivetti
2007-01-18 17:09:54 UTC
Look at this:
----------bug.py-------
import numpy
a=numpy.array([1,2])
b=a.sum()
print type(b)
c=numpy.random.permutation(b)
-----------------------
If I run it (Python 2.5, numpy 1.0.1 on a Linux box) I get:
-----------
#> python /tmp/bug.py
<type 'numpy.int32'>
Traceback (most recent call last):
File "/tmp/bug.py", line 5, in <module>
c=numpy.random.permutation(b)
File "mtrand.pyx", line 1227, in mtrand.RandomState.permutation
File "mtrand.pyx", line 1211, in mtrand.RandomState.shuffle
TypeError: len() of unsized object
-----------
permutation() likes 'int' and dislikes 'numpy.int32' integers :(
Seems a bug.
HTH,
Emanuele
----------bug.py-------
import numpy
a=numpy.array([1,2])
b=a.sum()
print type(b)
c=numpy.random.permutation(b)
-----------------------
If I run it (Python 2.5, numpy 1.0.1 on a Linux box) I get:
-----------
#> python /tmp/bug.py
<type 'numpy.int32'>
Traceback (most recent call last):
File "/tmp/bug.py", line 5, in <module>
c=numpy.random.permutation(b)
File "mtrand.pyx", line 1227, in mtrand.RandomState.permutation
File "mtrand.pyx", line 1211, in mtrand.RandomState.shuffle
TypeError: len() of unsized object
-----------
permutation() likes 'int' and dislikes 'numpy.int32' integers :(
Seems a bug.
HTH,
Emanuele