[Numpy-discussion] Reversing an array in-place

Sturla Molden sturla@molden...
Tue Dec 21 13:51:18 CST 2010


Chuck wrote:

> The reversed matrix is a view,  no copyihg is done. It is even faster than
> an inplace reversal.

This is why I love NumPy. In C, Fortran or Matlab most programmers would
probably form the reversed array. In NumPy we just change some
metainformation (data pointer and strides) behind the scenes. It cannot be
done more efficiently than that.

Sturla



More information about the NumPy-Discussion mailing list