The NumPy Fortran-ordering quiz

George Nurser gnurser at
Wed Oct 18 17:21:19 CDT 2006

On 18/10/06, Charles R Harris <charlesr.harris at> wrote:
> On 10/18/06, George Nurser <gnurser at> wrote:
> > > > None of the LaPack stuff seems to use the Fortran stuff, they just
> > > > transpose and copy.
> >
> > You've got me worried here. I have assumed that when you start with a
> > c-contiguous array, a, with say, a.shape = (m,n), if you use the
> > transpose as an argument to a fortran routine which requires an mxn
> > size array, then no copying is required.
> >
> > This seems to work for me -- the transpose *does* have fortran order.
> Nope. The result is an (n,m) array in fortran order, not an (m,n) array in
> fortran order.

Presumably that's because it's a view of the original array.

>> > Also, in f2py, if I use -DF2PY_REPORT_ON_ARRAY_COPY=1 I receive no
> > alert of any copy.
> f2py takes care of the ordering, which is one reason why it is so useful.

Yes, when I first used it, I assumed that the fortran routine had to
use an nxm array. But f2py is clever enough to make the above work.


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

More information about the Numpy-discussion mailing list