[Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Damian Eads
Good day, Reversing a 1-dimensional array in numpy is simple, A = A[:,:,-1] . However A is a new array referring to the old one and is no longer contiguous. While trying to reverse an array in place and keep it contiguous, I encountered some weird behavior. The reason for keeping it

Re: [Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Gael Varoquaux
On Sun, Feb 03, 2008 at 12:25:56PM -0700, Damian Eads wrote: On similar note, does the assignment A = A * B create a new array with a new buffer to hold the result of A * B, and assign A to refer to the new array? Yes. Without a JIT, Python cannot know that A is present both on the

Re: [Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Damian Eads
Damian Eads wrote: Good day, Reversing a 1-dimensional array in numpy is simple, A = A[:,:,-1] . Err, I meant A=A[::-1] here. My apologies. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Robert Kern
Damian Eads wrote: Here's another question: is there any way to construct a numpy array and specify the buffer address where it should store its values? I ask because I would like to construct numpy arrays that work on buffers that come from mmap. Can you clarify that a little? By buffer

Re: [Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Damian Eads
Thanks Anne for your very informative response. Anne Archibald wrote: On 03/02/2008, Damian Eads [EMAIL PROTECTED] wrote: Good day, Reversing a 1-dimensional array in numpy is simple, A = A[:,:,-1] . However A is a new array referring to the old one and is no longer contiguous.

Re: [Numpy-discussion] Unexpected behavior with numpy array

2008-02-03 Thread Robert Kern
Damian Eads wrote: Robert Kern wrote: Damian Eads wrote: Here's another question: is there any way to construct a numpy array and specify the buffer address where it should store its values? I ask because I would like to construct numpy arrays that work on buffers that come from mmap.