[Numpy-discussion] general version of repmat?
wbaxter at gmail.com
Fri Sep 22 09:41:36 CDT 2006
On 9/22/06, Alan G Isaac <aisaac at american.edu> wrote:
> On Fri, 22 Sep 2006, Bill Baxter apparently wrote:
> > Ok, here's my best shot at a generalized repmat:
> Sorry to always repeat this suggestion when
> it comes to repmat, but I think the whole approach
> is wrong. A repmat should be a separate object type,
> which behaves like the described matrix but has only one
> copy of the repetitive data.
That may be true for some cases. But I usually start modifying the
data I create right after a repmat. It wouldn't help in that case.
So unless you're really making a lot of large repmats of arrays that
never change, or for use as temp variables, I can't see a separate
class being that much of a win, compared with the complexity of
implementing and maintaining it (think "fancy indexing"). YMMV.
However, repmat seems to be far less commonly needed in numpy than in
Matlab. I think that's mostly thanks to the broadcasting rules, which
already create a sort of implicit repmat of the input in many common
More information about the Numpy-discussion