Re: [Numpy-discussion] numpy.array(arr.flat) mutates arr if arr.flags.fortran: bug?

2010-03-27 Thread Zachary Pincus
 You should open a ticket for this.

http://projects.scipy.org/numpy/ticket/1439



On Mar 26, 2010, at 11:26 AM, Charles R Harris wrote:



 On Wed, Mar 24, 2010 at 1:13 PM, Zachary Pincus zachary.pin...@yale.edu 
  wrote:
 Hello,

 I assume it is a bug that calling numpy.array() on a flatiter of a
 fortran-strided array that owns its own data causes that array to be
 rearranged somehow?

 Not sure what happens with a fancier-strided array that also owns its
 own data (because I'm not sure how to create one of those in python).

 This is from the latest svn version (2.0.0.dev8302) but was also
 present in a previous version too.

 Zach


 In [9]: a = numpy.array([[1,2],[3,4]]).copy('F')

 In [10]: a
 Out[10]:
 array([[1, 2],
[3, 4]])

 In [11]: list(a.flat)
 Out[11]: [1, 2, 3, 4]

 In [12]: a # no problem
 Out[12]:
 array([[1, 2],
[3, 4]])

 In [13]: numpy.array(a.flat)
 Out[13]: array([1, 2, 3, 4])

 In [14]: a # this ain't right!
 Out[14]:
 array([[1, 3],
[2, 4]])

 In [15]: a = numpy.array([[1,2],[3,4]]).copy('C')

 In [16]: numpy.array(a.flat)
 Out[16]: array([1, 2, 3, 4])

 In [17]: a
 Out[17]:
 array([[1, 2],
[3, 4]])


 You should open a ticket for this.

 Chuck

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.array(arr.flat) mutates arr if arr.flags.fortran: bug?

2010-03-26 Thread Charles R Harris
On Wed, Mar 24, 2010 at 1:13 PM, Zachary Pincus zachary.pin...@yale.eduwrote:

 Hello,

 I assume it is a bug that calling numpy.array() on a flatiter of a
 fortran-strided array that owns its own data causes that array to be
 rearranged somehow?

 Not sure what happens with a fancier-strided array that also owns its
 own data (because I'm not sure how to create one of those in python).

 This is from the latest svn version (2.0.0.dev8302) but was also
 present in a previous version too.

 Zach


 In [9]: a = numpy.array([[1,2],[3,4]]).copy('F')

 In [10]: a
 Out[10]:
 array([[1, 2],
[3, 4]])

 In [11]: list(a.flat)
 Out[11]: [1, 2, 3, 4]

 In [12]: a # no problem
 Out[12]:
 array([[1, 2],
[3, 4]])

 In [13]: numpy.array(a.flat)
 Out[13]: array([1, 2, 3, 4])

 In [14]: a # this ain't right!
 Out[14]:
 array([[1, 3],
[2, 4]])

 In [15]: a = numpy.array([[1,2],[3,4]]).copy('C')

 In [16]: numpy.array(a.flat)
 Out[16]: array([1, 2, 3, 4])

 In [17]: a
 Out[17]:
 array([[1, 2],
[3, 4]])


You should open a ticket for this.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.array(arr.flat) mutates arr if arr.flags.fortran: bug?

2010-03-25 Thread Travis Oliphant

On Mar 24, 2010, at 2:13 PM, Zachary Pincus wrote:

 Hello,

 I assume it is a bug that calling numpy.array() on a flatiter of a
 fortran-strided array that owns its own data causes that array to be
 rearranged somehow?

 Not sure what happens with a fancier-strided array that also owns its
 own data (because I'm not sure how to create one of those in python).

 This is from the latest svn version (2.0.0.dev8302) but was also
 present in a previous version too.

Hmm..   Yeah, this doesn't seem right.

I'm not really sure what

array(a.flat) should return since a.flat is an iterator...

but what it's doing is not right.

-Travis


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.array(arr.flat) mutates arr if arr.flags.fortran: bug?

2010-03-24 Thread Zachary Pincus
Hello,

I assume it is a bug that calling numpy.array() on a flatiter of a  
fortran-strided array that owns its own data causes that array to be  
rearranged somehow?

Not sure what happens with a fancier-strided array that also owns its  
own data (because I'm not sure how to create one of those in python).

This is from the latest svn version (2.0.0.dev8302) but was also  
present in a previous version too.

Zach


In [9]: a = numpy.array([[1,2],[3,4]]).copy('F')

In [10]: a
Out[10]:
array([[1, 2],
[3, 4]])

In [11]: list(a.flat)
Out[11]: [1, 2, 3, 4]

In [12]: a # no problem
Out[12]:
array([[1, 2],
[3, 4]])

In [13]: numpy.array(a.flat)
Out[13]: array([1, 2, 3, 4])

In [14]: a # this ain't right!
Out[14]:
array([[1, 3],
[2, 4]])

In [15]: a = numpy.array([[1,2],[3,4]]).copy('C')

In [16]: numpy.array(a.flat)
Out[16]: array([1, 2, 3, 4])

In [17]: a
Out[17]:
array([[1, 2],
[3, 4]])

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion