[Numpy-discussion] Fortran was dead ... [was Re: rewriting NumPy code in C or C++ or similar]
Wed Mar 16 09:00:09 CDT 2011
On Wed, Mar 16, 2011 at 09:46, Neal Becker <firstname.lastname@example.org> wrote:
> Sturla Molden wrote:
> > Den 16.03.2011 13:25, skrev Sturla Molden:
> >> Fortran 90 pointers create a view.
> >> real*8, target :: array(n,m)
> >> real*8, pointer :: view
> >> view => array(::2, ::2)
> > Pardon, the second line should be
> > real*8, pointer :: view(:,:)
> > Sturla
> * can it adopt external memory?
What is external memory?
> * can it interwork with numpy? (kinda required for this audience)
You can use f2py, swig, ctypes, or just Python extension to invoke Fortran
code and pass numpy arrays to it and get them back. Not sure whether or not
Cython has Fortran support, but Cython can be used as a simplified approach
of Python extension.
Usually numpy arrays are allocated on heap. In this way we can minimize
allocate()/deallocate() inside Fortran subroutines and let Python to do the
Fortran pointers are more like a view rather than C pointers which point to
the beginning of a memory block.
> NumPy-Discussion mailing list
PhD candidate of Mechanical Engineering
The Ohio State University, Columbus, Ohio
+1 (614) 859 2436
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion