Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-18 Thread Francesc Alted
A Wednesday 17 March 2010 22:56:20 Charles R Harris escrigué: On Wed, Mar 17, 2010 at 8:42 AM, Alan G Isaac ais...@american.edu wrote: On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote: numpy.resize(a, new_shape) Return a new array with the specified shape. If the new array is

Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-18 Thread Sebastian Haase
On Wed, Mar 17, 2010 at 10:56 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 17, 2010 at 8:42 AM, Alan G Isaac ais...@american.edu wrote: On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote: numpy.resize(a, new_shape) Return a new array with the specified shape. If

Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-18 Thread Gael Varoquaux
On Thu, Mar 18, 2010 at 09:56:21AM +0100, Sebastian Haase wrote: How would people feel about unifying the function vs. the method behavior ? One could add an addition option like `repeat` or `fillZero`. You mean fill_zero... Sorry, my linter went off. :) Gaël

[Numpy-discussion] bug in ndarray.resize?

2010-03-17 Thread Alan G Isaac
Is the zero-fill intentional? If so, it is documented? (NumPy 1.3) Alan Isaac a = np.arange(5) b = a.copy() c = np.resize(a, (5,2)) b.resize((5,2)) c # as expected array([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]]) b # surprise! array([[0, 1], [2, 3],

Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-17 Thread josef . pktd
On Wed, Mar 17, 2010 at 10:08 AM, Alan G Isaac ais...@american.edu wrote: Is the zero-fill intentional? If so, it is documented? (NumPy 1.3) Alan Isaac a = np.arange(5) b = a.copy() c = np.resize(a, (5,2)) b.resize((5,2)) c  # as expected array([[0, 1],        [2, 3],        [4, 0],

Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-17 Thread Alan G Isaac
On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote: numpy.resize(a, new_shape) Return a new array with the specified shape. If the new array is larger than the original array, then the new array is filled with repeated copied of a. Note that this behavior is different from a.resize(new_shape)

Re: [Numpy-discussion] bug in ndarray.resize?

2010-03-17 Thread Charles R Harris
On Wed, Mar 17, 2010 at 8:42 AM, Alan G Isaac ais...@american.edu wrote: On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote: numpy.resize(a, new_shape) Return a new array with the specified shape. If the new array is larger than the original array, then the new array is filled with