From: Charles R H. <cha...@gm...> - 2006-10-18 02:28:39
|
On 10/17/06, Travis Oliphant <oli...@ie...> wrote: > > Charles R Harris wrote: > > > > > > On 10/17/06, *Lisandro Dalcin* <da...@gm... > > <mailto:da...@gm...>> wrote: > > > > I was surprised by this > > > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > > Out[14]: > > array([[1, 5], > > [4, 3], > > [2, 6]]) > > > > > > This one still looks wrong. > > Why does this look wrong. What do you want it to be? Perhaps you are > thinking about the input array as C-order and the output array as > Fortran order. That's not what reshape does. The order argument > specifies how you think about both the input and output. > > Thus, reshape does the equivalent of a Fortran ravel to [1,4,2,5,3,6] > and then a Fortran-order based fill of an empty (3,2) array: giving you > the result. Why a Fortran ravel? I am thinking of it as preserving the memory layout, just messing with how it is addressed. Chuck |