[Numpy-discussion] can't import repmat from numpy

Pauli Virtanen ptvirtan@cc.hut...
Mon Apr 30 02:22:01 CDT 2007


dmitrey kirjoitti:
> What's wrong?
> 
> start python shell;
> 
> from numpy import sin   => all ok
> 
> from numpy import repmat =>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: cannot import name repmat

In numpy, the equivalent function is called tile:

>>> from numpy import *
>>> a = array([[1,2],[3,4]])
>>> tile(a, (2,3))
array([[1, 2, 1, 2, 1, 2],
       [3, 4, 3, 4, 3, 4],
       [1, 2, 1, 2, 1, 2],
       [3, 4, 3, 4, 3, 4]])

I note that http://www.scipy.org/NumPy_for_Matlab_Users advertises
repmat instead of tile. (repmat is in numpy.matlib, a compatibility
wrapper library) Maybe this should be fixed?

-- 
Pauli Virtanen


More information about the Numpy-discussion mailing list