[Numpy-discussion] Change of behavior in flatten between 1.0.4 and 1.1
Stuart Brorson
sdb at cloud9.net
Tue Jul 1 17:18:55 EDT 2008
Hi --
I have noticed a change in the behavior of numpy.flatten(True) between
NumPy 1.0.4 and NumPy 1.1. The change affects 3D arrays. I am
wondering if this is a bug or a feature.
Here's the change. Note that the output from flatten(True) is
different between 1.0.4 and 1.1.
======= First the preliminary set up: =======
In [3]: A = numpy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10],
[11, 12]]])
In [4]: A
Out[4]:
array([[[ 1, 2],
[ 3, 4]],
[[ 5, 6],
[ 7, 8]],
[[ 9, 10],
[11, 12]]])
======= Now the change: Numpy 1.0.4 =======
In [5]: A.flatten()
Out[5]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
In [6]: A.flatten(True)
Out[6]: array([ 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12])
======= Numpy 1.1 =======
In [4]: A.flatten()
Out[4]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
In [5]: A.flatten(True)
Out[5]: array([ 1, 5, 9, 3, 7, 11, 2, 6, 10, 4, 8, 12])
Note that the output of A.flatten(True) is different.
Is this a bug or a feature?
Cheers,
Stuart Brorson
Interactive Supercomputing, inc.
135 Beaver Street | Waltham | MA | 02452 | USA
http://www.interactivesupercomputing.com/
More information about the NumPy-Discussion
mailing list