Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Travis Oliphant
Charles R Harris wrote: > > > On 5/23/07, *Albert Strasheim* <[EMAIL PROTECTED] > > wrote: > > Hello all > > On Wed, 23 May 2007, Anne Archibald wrote: > > > On 23/05/07, Albert Strasheim <[EMAIL PROTECTED] > > wrote: > > >

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Travis Oliphant
Albert Strasheim wrote: > Hello all > > Consider the following example: > > In [43]: x = N.zeros((3,2)) > > In [44]: x.flags > Out[44]: > C_CONTIGUOUS : True > F_CONTIGUOUS : False > OWNDATA : True > WRITEABLE : True > ALIGNED : True > UPDATEIFCOPY : False > > In [45]: x[:,[1,0]].flags

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Timothy Hochberg
I'm not sure why the data ends up F_CONTIGUOUS, but it appears that you can get things to end up as C_CONTIGUOUS by transposing before the indexing and then transposing back. I don't think that this results in extra copies, but I'm not certain of that. a = np.arange(6).reshape(3,2) a array([[0,

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Charles R Harris
On 5/23/07, Anne Archibald <[EMAIL PROTECTED]> wrote: On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > If you are correct that this is in fact a fresh new array, I really > don't understand where the values of these flags. To recap: > > In [19]: x = N.zeros((3,2)) > > In [20]: x.flags

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Charles R Harris
On 5/23/07, Charles R Harris <[EMAIL PROTECTED]> wrote: On 5/23/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > > Hello all > > On Wed, 23 May 2007, Anne Archibald wrote: > > > On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > > > > > Consider the following example: > > > > First a

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Charles R Harris
On 5/23/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: Hello all On Wed, 23 May 2007, Anne Archibald wrote: > On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > > > Consider the following example: > > First a comment: almost nobody needs to care how the data is stored > internally. Tr

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Anne Archibald
On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > If you are correct that this is in fact a fresh new array, I really > don't understand where the values of these flags. To recap: > > In [19]: x = N.zeros((3,2)) > > In [20]: x.flags > Out[20]: > C_CONTIGUOUS : True > F_CONTIGUOUS : Fa

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Stefan van der Walt
On Wed, May 23, 2007 at 09:49:08AM -0400, Anne Archibald wrote: > On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > > > Is it correct that the F_CONTIGUOUS flag is set in the case of the fancy > > indexed x? I'm running NumPy 1.0.3.dev3792 here. > > Numpy arrays are always stored in conti

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Albert Strasheim
Hello all On Wed, 23 May 2007, Anne Archibald wrote: > On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > > > Consider the following example: > > First a comment: almost nobody needs to care how the data is stored > internally. Try to avoid looking at the flags unless you're > interfaci

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Anne Archibald
On 23/05/07, Albert Strasheim <[EMAIL PROTECTED]> wrote: > Consider the following example: First a comment: almost nobody needs to care how the data is stored internally. Try to avoid looking at the flags unless you're interfacing with a C library. The nice feature of numpy is that it hides all t

[Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Albert Strasheim
Hello all Consider the following example: In [43]: x = N.zeros((3,2)) In [44]: x.flags Out[44]: C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False In [45]: x[:,[1,0]].flags Out[45]: C_CONTIGUOUS : False F_CONTIGUOUS : Tru