f2py

f2py: Specifying real precision in fortran when interfacing with python?

懵懂的女人 提交于 2019-11-27 01:58:50
问题 I am playing around with f2py. I'm a bit confused about numpy intrinsic types vs. fortran 90 types. It seems like I can only use single precision reals in fortran 90, when interacting with python. Let me illustrate with an example: Say I have this fortran 90 module, test.f90, to be compiled with f2py and imported in python: module test implicit none integer, parameter :: sp = selected_real_kind(6,37) ! single precision integer, parameter :: dp = selected_real_kind(15,307) ! double precision