[Numpy-discussion] Fortran was dead ... [was Re: rewriting NumPy code in C or C++ or similar]

Sturla Molden sturla at molden.no
Wed Mar 23 06:42:06 EDT 2011


Den 16.03.2011 14:46, skrev Neal Becker:
> Also:
> * can it adopt external memory?

Yes.

Using CRAY pointers with libc malloc/free is e.g. a common way to get 
dynamic memory in Fortran 77.

> * can it interwork with numpy? (kinda required for this audience)
>

Yes, that is why NumPy has f2py :-)

- Explicit shape and assumed size arrays can be passed as a pointer to 
the first element. We can use numpy.f2py, ctypes or Cython for this 
purpose. I usually put all my Fortran 95 code in modules, and expose 
them to Python via driver subroutines.

- Fortran 2003 has bindings for ISO C that makes this portable. fwrap 
automates this process, so we don't have to write all the boilerplate 
code by hand. It is still immature though, e.g. no sujpport for modules 
last time I checked.

Sturla


















More information about the NumPy-Discussion mailing list