[Numpy-discussion] tile() can't handle empty arrays

dmitrey openopt@ukr....
Sun Jun 10 10:16:51 CDT 2007


in octave
repmat([],2,3) works well:
ans = [](0x0)
I guess in MATLAB too
but numpy tile() can't handle it correctly:

 >>> from numpy import *
 >>> tile(array([1]), (2,3))
array([[1, 1, 1],
       [1, 1, 1]])
 >>> tile(array([]), (2,3))
Traceback (innermost last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/numpy/lib/shape_base.py", line 
623, in tile
    c = c.reshape(-1,n).repeat(nrep,0)
ValueError: total size of new array must be unchanged

(I have numpy 1.0.1)
D.


More information about the Numpy-discussion mailing list