On 10/6/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Bill Baxter wrote: > > 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. > > > Doesn't repmat imply matrix and thus 2d arrays? It is pretty horrible > though.
It does kind of imply that (which is why I think something like 'reparray' would be a better name) but even matlab's repmat() function doesn't restrict you to 2D arrays, and I'm pretty sure numpy.repmat was intended to be a clone of that. > > 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. > > > I presume shape actually means number of repetitions, and not shape. If > so, shape is the wrong name for the second argument. Anyway as long as > your breaking backward compatibility you might as well improve the name. Yeh, that did occur to me. Maybe 'reps' would be a better name for the argument. > > 3) add a new method like reparray(A, shape) that has the multidim > > ability, and matches numpy conventions. > > > Same comment on the name shape. > > > > 4) if 3), move repmat out of the top-level namespace to indicate > > deprecation > > > 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 (?). 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion