[Numpy-discussion] repmat

Bill Baxter wbaxter at gmail.com
Thu Oct 5 20:30:43 CDT 2006

[There seem to have been some gmail delivery problems that prevented
my previous mail on this subject from being delivered]

I've proposed that we fix repmat handle arbitrary dimensions before 1.0.


I don't think this is particularly controversial, just I'm guessing
no-one's found the time to look at my proposed fixes.  And
gmail/sourceforge issues haven't helped either.

In short, repmat(A, M,N) is an oddball.  It only deals with 2D arrays.

We should do some combination of:
1) change repmat(A, M,N) to repmat(A, *dims) to add multidim ability
to it, while maintaining backwards compatibility.
2) change repmat(A, M,N) to repmat(A, shape) to add multidim ability
to it, and bring it into line with the "numpy standard" of shapes
being passed as one tuple arg.
3) add a new method like reparray(A, shape) that has the multidim
ability, and matches numpy conventions.
4)   if 3), move repmat out of the top-level namespace to indicate deprecation

The tracker item has all the code necessary to implement these fixes,
it's just a matter of deciding which one to go with.

My personal preference would be a combination of 1 and 3.  Add
reparray(A,shape) , and change repmat to repmat(A, *shape).  Then just
implement repmat as a call to reparray.

If someone will decide which route to go, I'd be happy to provide an
actual patch against the latest SVN to implement that decision.

If this is somehow controversial for some reason then let's discuss
it.  But so far the only response has been "copying data is a bad
idea", which is really a separate issue.


More information about the Numpy-discussion mailing list