returning values from FORTRAN with f2py

Bengt Richter bokr at
Sat Sep 7 17:11:10 EDT 2002

On 7 Sep 2002 12:22:16 -0700, spam at (Chris Fonnesbeck) wrote:

>I am wondering how to persuade some fortran code that I have compiled
>with f2py to return its calculated values to me in python.  I have
>some code that does gaussian elimination (mostly from Numerical
>Reciopes), and is supposed to return an inverted matrix so that I can
>solve a system of linear equations.  However, when run in python, the
>function runs without error but returns no values:
>>>> a = [[2,1,3],[1,-1,1],[3,6,-1]]
>>>> b = [7,2,10]
>>>> import gauss
>>>> gauss.gauss(a,3,b,1)
>Is there something that I have to change in my fortran code to make
>this work?
Have you looked at
or maybe

Perhaps there is an easier route to your goal? (I haven't used the above,
but numpy seems to be recommended frequently).

Bengt Richter

More information about the Python-list mailing list