The NumPy Fortran-ordering quiz

Travis Oliphant oliphant.travis at ieee.org
Wed Oct 18 13:28:40 CDT 2006


>
> I'm not talking about the keyword in the ravel call, I'm talking about 
> the flag in a.
Ah.  Yes, I see.  I misunderstood.  Of course ravel ignores the FORTRAN 
flag (actually it doesn't because if a copy is not necessary it doesn't 
make one).    The key is that the Python user doesn't need to care about 
the array flag unless they are interfacing to compiled code.  That's the 
point of the flag.  It's actually redundant because it could be checked 
every time it's needed.  But, right now, it's kept updated so that the 
check is simple.   The same is true with the C-CONTIGUOUS flag (called 
contiguous).

> The question is: do we *need* a fortran flag.
No, you don't *need* the flag.  But, it saves copying data to check it 
(look how many times ISFORTRAN is called in the code).  Without the flag 
all of those cases would need to do a strides-check which is done in the 
UpdateFlags code.
> 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.
I disagree.  It's actually not that complicated.  The FORTRAN flag gives 
us a lot more flexibility when it comes to copying data or not.  I think 
part of the complication is that you are misunderstanding some of the 
terms and the purposes of the keywords.
> None of the LaPack stuff seems to use the Fortran stuff, they just 
> transpose and copy.
It doesn't now only because I haven't had time to go through and change 
it, but it should.   Look at scipy's LaPack interface.  It (through 
f2py) uses the FORTRAN stuff extensively (much was borrowed from there 
in the first place).

-Travis


-------------------------------------------------------------------------
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




More information about the Numpy-discussion mailing list