Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-13 Thread Travis Oliphant
>>> Yep, that'd be a good idea. Want to write a patch? :-) >> >> https://github.com/numpy/numpy/pull/440 > > Thinking about the other thread, and the 'number of elements' check, I > noticed this: > > In [51]: np.__version__ > Out[51]: '1.6.1' > > In [52]: r4 = range(4) > > In [53]: r3 = range(

Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-13 Thread Matthew Brett
Hi, On Thu, Sep 13, 2012 at 11:31 AM, Matthew Brett wrote: > On Wed, Sep 12, 2012 at 4:19 PM, Nathaniel Smith wrote: >> On Wed, Sep 12, 2012 at 2:46 PM, Matthew Brett >> wrote: >>> Hi, >>> >>> I just noticed that this works for numpy 1.6.1: >>> >>> In [36]: np.concatenate(([2, 3], [1]), 1) >>>

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Travis Oliphant
>> >> >> This is expected behavior. It's how the concatenate Python function >> manages to handle axis=None to flatten the arrays before concatenation. >> This has been in NumPy since 1.0 and should not be changed without >> deprecation warnings which I am -0 on. >> >> Now, it is true th

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Matthew Brett
Hi, On Thu, Sep 13, 2012 at 3:01 PM, Travis Oliphant wrote: > > On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: > >> On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett >> wrote: >>> Hi, >>> >>> While writing some tests for np.concatenate, I ran foul of this code: >>> >>>if (axis >= NPY_MAX

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Daπid
On Thu, Sep 13, 2012 at 6:39 PM, Warren Weckesser wrote: > I would expect an error, consistent with the behavior when 1 < axis < 32. In that case, you are hitting the dimension limit. np.concatenate((a,b), axis=31) ValueError: bad axis1 argument to swapaxes Where axis=32, axis=3500, axis=None a

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Travis Oliphant
On Sep 13, 2012, at 11:39 AM, Warren Weckesser wrote: > > > On Thu, Sep 13, 2012 at 9:01 AM, Travis Oliphant wrote: > > On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: > > > On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett > > wrote: > >> Hi, > >> > >> While writing some tests for np.co

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Warren Weckesser
On Thu, Sep 13, 2012 at 9:01 AM, Travis Oliphant wrote: > > On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: > > > On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett > wrote: > >> Hi, > >> > >> While writing some tests for np.concatenate, I ran foul of this code: > >> > >>if (axis >= NPY_MAXD

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Travis Oliphant
On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: > On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett > wrote: >> Hi, >> >> While writing some tests for np.concatenate, I ran foul of this code: >> >>if (axis >= NPY_MAXDIMS) { >>ret = PyArray_ConcatenateFlattenedArrays(narrays, arr

Re: [Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Nathaniel Smith
On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett wrote: > Hi, > > While writing some tests for np.concatenate, I ran foul of this code: > > if (axis >= NPY_MAXDIMS) { > ret = PyArray_ConcatenateFlattenedArrays(narrays, arrays, NPY_CORDER); > } > else { > ret = PyArray_Co

Re: [Numpy-discussion] Contiguity of result of astype changed - intentional?

2012-09-13 Thread Matthew Brett
Hi, On Wed, Sep 12, 2012 at 10:24 PM, Ondřej Čertík wrote: > Hi Matt, > > On Wed, Sep 12, 2012 at 1:27 PM, Travis Oliphant wrote: > > Is this intended? Is there a performance reason to keep the same > strides in 1.7.0? I believe that this could be because in 1.7.0, NumPy w

Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-13 Thread Matthew Brett
On Wed, Sep 12, 2012 at 4:19 PM, Nathaniel Smith wrote: > On Wed, Sep 12, 2012 at 2:46 PM, Matthew Brett > wrote: >> Hi, >> >> I just noticed that this works for numpy 1.6.1: >> >> In [36]: np.concatenate(([2, 3], [1]), 1) >> Out[36]: array([2, 3, 1]) >> >> but the beta release branch: >> >> In

[Numpy-discussion] Obscure code in concatenate code path?

2012-09-13 Thread Matthew Brett
Hi, While writing some tests for np.concatenate, I ran foul of this code: if (axis >= NPY_MAXDIMS) { ret = PyArray_ConcatenateFlattenedArrays(narrays, arrays, NPY_CORDER); } else { ret = PyArray_ConcatenateArrays(narrays, arrays, axis); } in multiarraymodule.c So