[SciPy-dev] Cython, f2py and GSoC

Sturla Molden sturla at molden.no
Fri Mar 27 09:59:57 EDT 2009


On 3/26/2009 8:43 PM, Dag Sverre Seljebotn wrote:

> b) While there's a clear technical seperation between Fortran <-> C and 
> C <-> Cython, the main challenge is the same both places (dealing with 
> strided arrays on a C level) and so it's benefitial to have them within 
> the same project.

Do you need to pass strided arrays to Fortran? Would not a local copy 
suffice?

Also consider that the Fortran 2003 function C_F_POINTER (used to 
convert a C pointer to a Fortran array pointer) assumes the C pointer 
references a continuous array. You would have to pass in the original 
unstrided array, create one Fortran pointer with C_F_POINTER and then 
index this with appropriate strides. Most likely the Fortran compiler 
would react to these strides by making its own local copy, which would 
make these efforts a bit futile. It is easier to always pass contiguous 
arrays to Fortran, and in most cases just as efficient.



S.M.



More information about the SciPy-Dev mailing list