[Numpy-discussion] repmat equivalent?

Albert Strasheim fullung at gmail.com
Thu Feb 23 04:46:01 CST 2006

Hello all

On 2/23/06, Stefan van der Walt <stefan at sun.ac.za> wrote:
> On Thu, Feb 23, 2006 at 01:31:47PM +0200, Albert Strasheim wrote:
> > More than 2 dimensions is tricky, since NumPy and MATLAB don't seem to
> > agree on how more-dimensional data is organised? As such, I don't know
> > what a NumPy user would expect repmat to do with more than 2
> > dimensions.
> To expand on this, here is what I see when I create (M,N,3) matrices
> in both octave and numpy.  I expect to see an MxN matrix stacked 3
> high:


There are other (unexpected, for me at least) differences between
MATLAB/Octave and NumPy too. For a 3D array in MATLAB, only indexing
on the last dimension yields a 2D array, where NumPy always returns a
2D array.

I put some examples for the 3D case at:




More information about the Numpy-discussion mailing list