Cannot make inline Fortran compiler (f2py) work
Hello!
I am trying to make the inline Fortran compiler work. It gave some long errors in Sage 5.5. Now I try in Sage 5.6 (Ubuntu 11.10 64 bit): The evaluation of %fortran cell returns None , but no symbols seem to be defined.
I tried the simple Fibonacci example from the documentation and it did not work as it should. The ordinary command-line compilation with f2py works ok!
Please, could anyone try to help me.
%fortran
C FILE: FIB3.F
SUBROUTINE FIB(A,N)
C
C CALCULATE FIRST N FIBONACCI NUMBERS
C
INTEGER N
REAL*8 A(N)
Cf2py intent(in) n
Cf2py intent(out) a
Cf2py depend(n) a
DO I=1,N
IF (I.EQ.1) THEN
A(I) = 0.0D0
ELSEIF (I.EQ.2) THEN
A(I) = 1.0D0
ELSE
A(I) = A(I-1) + A(I-2)
ENDIF
ENDDO
END
C END FILE FIB3.F
None
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_41.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZmliKDUp"),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>
File "/tmp/tmpBVbhBE/___code___.py", line 3, in <module> exec compile(u'fib(_sage_const_5 ) File "", line 1, in <module>
NameError: name 'fib' is not defined
Best wishes, Sergey