![]() | In Fortran (and C/C++) functions often modify arguments; here the result s is an output argument:
subroutine hw3(r1, r2, s) real*8 r1, r2, s s = sin(r1 + r2) return end |
![]() | Running F2PY results in a module with wrong behavior:
>>> from hw import hw3 >>> r1 = 1; r2 = -1; s = 10 >>> hw3(r1, r2, s) >>> print s 10 # should be 0 |
![]() | Why? F2PY assumes that all arguments are input arguments |
![]() | Output arguments must be explicitly specified! |