The NumPy Fortran-ordering quiz

Charles R Harris charlesr.harris at gmail.com
Tue Oct 17 22:28:37 EDT 2006


On 10/17/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> Charles R Harris wrote:
> >
> >
> > On 10/17/06, *Lisandro Dalcin* <dalcinl at gmail.com
> > <mailto:dalcinl at gmail.com>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061017/c888f96b/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list