Re: [Numpy-discussion] Reversing an array in-place

2010-12-21 Thread Sturla Molden
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) behin

Re: [Numpy-discussion] Reversing an array in-place

2010-12-20 Thread Justin Peel
Oh, you're quite right. I should have looked more closely into this. Thanks for the reply. On Mon, Dec 20, 2010 at 2:15 PM, Charles R Harris wrote: > > > On Mon, Dec 20, 2010 at 1:25 PM, Justin Peel wrote: >> >> I noticed that there is currently no way to reverse a numpy array >> in-place. The c

Re: [Numpy-discussion] Reversing an array in-place

2010-12-20 Thread Charles R Harris
On Mon, Dec 20, 2010 at 1:25 PM, Justin Peel 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. No

[Numpy-discussion] Reversing an array in-place

2010-12-20 Thread Justin Peel
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 slici