Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Anne Archibald
2008/7/9 Robert Kern [EMAIL PROTECTED]: Because that's just what a buffer= argument *is*. It is not a place for presenting the starting pointer to exotically-strided memory. Use __array_interface__s to describe the full range of representable memory. See below. Aha! Is this stuff documented

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Charles R Harris
On Thu, Jul 10, 2008 at 9:33 AM, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/9 Robert Kern [EMAIL PROTECTED]: Because that's just what a buffer= argument *is*. It is not a place for presenting the starting pointer to exotically-strided memory. Use __array_interface__s to describe the

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Stéfan van der Walt
2008/7/10 Robert Kern [EMAIL PROTECTED]: I was about a week ahead of you. See numpy/lib/stride_tricks.py in the trunk. Robert, this is fantastic! I think people are going to enjoy your talk at SciPy'08. If you want, we could also tutor this in the advanced NumPy session. Cheers Stéfan

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Anne Archibald
2008/7/10 Charles R Harris [EMAIL PROTECTED]: On Thu, Jul 10, 2008 at 9:33 AM, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/9 Robert Kern [EMAIL PROTECTED]: Because that's just what a buffer= argument *is*. It is not a place for presenting the starting pointer to exotically-strided

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Charles R Harris
On Thu, Jul 10, 2008 at 2:25 PM, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/10 Charles R Harris [EMAIL PROTECTED]: On Thu, Jul 10, 2008 at 9:33 AM, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/9 Robert Kern [EMAIL PROTECTED]: Because that's just what a buffer= argument

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-10 Thread Robert Kern
On Thu, Jul 10, 2008 at 10:33, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/9 Robert Kern [EMAIL PROTECTED]: Because that's just what a buffer= argument *is*. It is not a place for presenting the starting pointer to exotically-strided memory. Use __array_interface__s to describe the full

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-09 Thread Robert Kern
On Wed, Jul 9, 2008 at 18:55, Anne Archibald [EMAIL PROTECTED] wrote: Hi, When trying to construct an ndarray, I sometimes run into the more-or-less mystifying error expected a single-segment buffer object: Out[54]: (0, 16, 8) In [55]: A=np.zeros(2); A=A[np.newaxis,...];

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-09 Thread Anne Archibald
2008/7/9 Robert Kern [EMAIL PROTECTED]: Yes, the buffer interface, at least the subset that ndarray() consumes, requires that all of the data be contiguous in memory. array_as_buffer() checks for that using PyArray_ISONE_SEGMENT(), which looks like this: #define PyArray_ISONESEGMENT(m)

Re: [Numpy-discussion] expected a single-segment buffer object

2008-07-09 Thread Robert Kern
On Wed, Jul 9, 2008 at 21:29, Anne Archibald [EMAIL PROTECTED] wrote: 2008/7/9 Robert Kern [EMAIL PROTECTED]: Yes, the buffer interface, at least the subset that ndarray() consumes, requires that all of the data be contiguous in memory. array_as_buffer() checks for that using