[Numpy-discussion] Fortran was dead ... [was Re: rewriting NumPy code in C or C++ or similar]
Yung-Yu Chen
yyc@solvcon....
Wed Mar 16 09:00:09 CDT 2011
On Wed, Mar 16, 2011 at 09:46, Neal Becker <ndbecker2@gmail.com> 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
>
> Also:
> * 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
memory management.
Fortran pointers are more like a view rather than C pointers which point to
the beginning of a memory block.
yyc
_______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
--
Yung-Yu Chen
PhD candidate of Mechanical Engineering
The Ohio State University, Columbus, Ohio
+1 (614) 859 2436
http://solvcon.net/yyc/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110316/15552676/attachment.html
More information about the NumPy-Discussion
mailing list