[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

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 n...@pobox.com wrote: On Wed, Sep 12, 2012 at 2:46 PM, Matthew Brett matthew.br...@gmail.com 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

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 ondrej.cer...@gmail.com wrote: Hi Matt, On Wed, Sep 12, 2012 at 1:27 PM, Travis Oliphant tra...@continuum.io 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

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 matthew.br...@gmail.com 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 {

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 matthew.br...@gmail.com wrote: Hi, While writing some tests for np.concatenate, I ran foul of this code: if (axis = NPY_MAXDIMS) { ret =

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 tra...@continuum.iowrote: On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, While writing some tests for np.concatenate, I ran foul of this code:

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 warren.weckes...@enthought.com 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

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 tra...@continuum.io wrote: On Sep 13, 2012, at 8:40 AM, Nathaniel Smith wrote: On Thu, Sep 13, 2012 at 11:12 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, While writing some tests for np.concatenate, I ran foul of this code:

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 that the C-API

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 matthew.br...@gmail.com wrote: On Wed, Sep 12, 2012 at 4:19 PM, Nathaniel Smith n...@pobox.com wrote: On Wed, Sep 12, 2012 at 2:46 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, I just noticed that this works for numpy 1.6.1: In

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(3) In [54]: