Re: [Numpy-discussion] Bug in as_strided/reshape

2012-08-10 Thread Dave Hirschfeld
Sebastian Berg sipsolutions.net> writes: > > Hello, > > looking at the code, when only adding/removing dimensions with size 1, > numpy takes a small shortcut, however it uses 0 stride lengths as value > for the new one element dimensions temporarily, then replacing it again > to ensure the new

Re: [Numpy-discussion] Bug in as_strided/reshape

2012-08-09 Thread Sebastian Berg
Hello, looking at the code, when only adding/removing dimensions with size 1, numpy takes a small shortcut, however it uses 0 stride lengths as value for the new one element dimensions temporarily, then replacing it again to ensure the new array is contiguous. This replacing does not check if the

Re: [Numpy-discussion] Bug in as_strided/reshape

2012-08-09 Thread Dave Hirschfeld
Dave Hirschfeld gmail.com> writes: > > It seems that reshape doesn't work correctly on an array which has been > resized using the 0-stride trick e.g. > > In [73]: x = array([5]) > > In [74]: y = as_strided(x, shape=(10,), strides=(0,)) > > In [75]: y > Out[75]: array([5, 5, 5, 5, 5, 5, 5, 5,

[Numpy-discussion] Bug in as_strided/reshape

2012-08-08 Thread Dave Hirschfeld
It seems that reshape doesn't work correctly on an array which has been resized using the 0-stride trick e.g. In [73]: x = array([5]) In [74]: y = as_strided(x, shape=(10,), strides=(0,)) In [75]: y Out[75]: array([5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) In [76]: y.reshape([10,1]) Out[76]: array([[