From: Stefan v. d. W. <st...@su...> - 2006-10-17 08:47:25
|
On Mon, Oct 16, 2006 at 02:20:04PM -0600, Charles R Harris wrote: > Travis, >=20 > I note that >=20 > >>> a =3D arange(6).reshape(2,3,order=3D'F') > >>> a > array([[0, 1, 2], > [3, 4, 5]]) >=20 > Shouldn't that be 3x2? Or maybe [[0,2,4],[1,3,5]]? Reshape is making a = copy, > but flat, flatten, and tostring all show the elements in 'C' order. I a= sk > because I wonder if changing the order can be used to prepare arrays fo= r input > into the LaPack routines. I think that the calculation of 'a' above is correct, but that the memory representation is incorrect. For example (see attached script -- which is overkill, I know), these commands: x =3D N.arange(6,dtype=3Dfloat).reshape((2,3),order=3D'F') catmem(x) x =3D N.array([[0,1,2],[3,4,5]],order=3D'F',dtype=3Dfloat) catmem(x) x =3D N.array(N.arange(6,dtype=3Dfloat).reshape((2,3)),order=3D'F') catmem(x) x =3D N.asfortranarray(N.arange(6,dtype=3Dfloat).reshape((2,3))) catmem(x) yield the following results: 0.000000 1.000000 2.000000 3.000000 4.000000 5.000000=20 0.000000 3.000000 1.000000 4.000000 2.000000 5.000000=20 0.000000 3.000000 1.000000 4.000000 2.000000 5.000000=20 0.000000 3.000000 1.000000 4.000000 2.000000 5.000000=20 Regards St=E9fan |