[Numpy-discussion] Reversing an array in-place

Sturla Molden sturla at molden.no
Tue Dec 21 14:51:18 EST 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