[Numpy-discussion] Reversing an array in-place
Charles R Harris
charlesr.harris at gmail.com
Mon Dec 20 16:15:25 EST 2010
On Mon, Dec 20, 2010 at 1:25 PM, Justin Peel <jpscipy at gmail.com> wrote:
> I noticed that there is currently no way to reverse a numpy array
> in-place. The current way to reverse a numpy array is using slicing,
> ala arr[::-1]. This is okay for small matrices, but for really large
> ones, this can be prohibitive. Not only that, but an in-place reverse
> is much faster than slicing. It seems like a reverse method could be
> added to arrays that would reverse the array along a given axis fairly
> easily. Is there any opposition to this?
The reversed matrix is a view, no copyihg is done. It is even faster than
an inplace reversal.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion