我正在開發一個包,它需要來自LAPACK Fortran庫的dgtsv subroutine的Python綁定。目前,我將Fortran源文件dgtsv.f與我的Python代碼一起分發,並使用numpy.distutils自動將其包裝並將其編譯到可從Python調用的共享庫_gtsv.so中。 這裏就是我的setup.py文件看起來像此刻: from numpy.distutils.core i
我有一個簡單的fortran子例程(僅用於測試python-fortran接口)。它看起來像這樣: subroutine sum2(x,y,z)
real(kind=8),intent(in)::x,y
real(kind=8),intent(inout)::z
z = x + y
print *, "sum is ", z
end subroutine sum2
後彙編與f2py我
我想使用docstring或類似的東西來記錄我的fortran例程,這些例程可以與python幫助命令一起使用。由f2py創建的自動生成的文檔字符串是非常不夠的,我需要添加更多的細節,就像我們用python函數docstring一樣。 在我的想法,它應該看起來像: mymod.f: subroutine foo()
! This is my function
end subroutine