[Numpy-discussion] repmat

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri Oct 6 02:04:44 EDT 2006


Bill Baxter wrote:
>
>> I'm not completely sold on the whole reparray thing: does repmat have
>> any use outside of the linear algebra convention of squashing a 3D array
>> into a 2D matrix (or however that goes)? If not, perhaps it should just
>> get left alone and exciled to matrix specific functions namespace. So:
>>     
>
> Well, I'm not sure about N-d, but I've definitely had a need for 1-d
> version of it.  That's what prompted me to look into this.  Also I
> think I read a comment in the other thread about pyEM that repmat()
> turned out to be one of the faster ways to implement
> something-or-other (?). 
It was in a very specific case, and it could have been replaced by an 
other function in this case without any loss of performance. The 
following is my experience with matlab/repmat: generally, repmat was 
necessary in many cases in matlab either for efficiency (big scalar 
matrix were slow to generate using ones and zeros, for example) and 
because matlab had almost no broadcasting rules, repmat was almost 
mandatory for matlab. In numpy, the syntax at least does not require 
repmat (at least, I never *had* to use it in numpy, and I used it a lot 
with matlab).

Moreoever, the slowness of some broadcasting seem solved in recent 
subversion (see my answer on the specific thread),

David
>  At the very least you could think of tiling
> 3D image data as one application, in fact 'tile()' is probably a
> better name for the function than 'reparray'.
>
> I was initially suprised that 'repeat()' featured so prominently in
> numpy.  I initially assumed it meant "repmat", and was surprised when
> it didn't do that.  I thought "why on earth would you want to do
> that?".  But it does turn out to have lots of uses (like implementing
> "repmat" ;-))
>
>   
>> +1 on deprecating, moving or otherwise getting rid of repmat.
>> Neutral on whether to replace it with something else, but if it is
>> replaced #3 looks like the correct route, but not with a different
>> argument name than 'shape'. Perhaps 'reps'.
>>     
>
> Hey!  Looks like we agree on the name of the argument, apparently.  :-)
> I do think there is a strong connection with "shape" though, that
> 'reps' hides. Maybe 'repshape' or 'tileshape'?  I'd be happy with
> reps, though.  Agreed that 'shape' is bad.  Makes it sound like you
> should specify the actual .shape of the output.
>
> --bb
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>   





More information about the NumPy-Discussion mailing list