The NumPy Fortran-ordering quiz

Tim Hochberg tim.hochberg at
Wed Oct 18 12:58:23 CDT 2006

Charles R Harris wrote:

> I'm not talking about the keyword in the ravel call, I'm talking about 
> the flag in a. The question is: do we *need* a fortran flag. I am 
> argueing not, because the only need is for fortran contiguous arrays 
> to pass to fortran function, or translation from fortran contiguous 
> arrays to numpy arrays. What I am saying is that things are 
> unnecessarily complicated. None of the LaPack stuff seems to use the 
> Fortran stuff, they just transpose and copy. I don't even think I want 
> to change that, because it is *clear* what is going on. Interfacing to 
> fortran is all about memory layout, nothing more or less.


There are two things here. One is the order keyword and one is the 
FORTRAN flag. The latter is mainly an optimization for use at the 
C-level so that one doesn't have to check whether a given array is in 
contiguous FORTRAN order by examining the strides, in the same way that 
the CONTIGUOUS flag allows you to skip examining the strides when you 
need a contiguous C-order matrix. I believe it is the former that you 
are objecting to, but it would help if you could specify whether you are 
talking about the order keyword or whether you are talking about the 

I'll also note that the order keyword could probably have been used to 
fix a performance problem someone was having a few weeks ago. We ended 
up transposing the data, but the individual felt that obscured the 
intent of the algorithm. I believe the same effect could probably have 
been been achieved without re jiggering the algorithm by using the order 


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