0

I have a fortran file with a lot of useful subroutines, and I want to make a Python interface to it using f2py.

The problem arises because some fortran subroutines call the FFT subroutine from the NAG library (named c06ebf). When imported into Python, it produces the 'undefined symbol: co6ebf' warning.

Is there other way to perform FFT within my Fortran subroutine and to be able to create Python interface from it using f2py?

1 Answers1

1

This problem is solved in a following way:

  1. All instances where commercial FFT library is called are replaced by calls to free FFT library (in this case FFTW3). Of course ' include "fftw3.f" ' is placed on top of the fortran subroutines where necessary.

  2. Extension module is created using f2py. First line creates the signature file, and in second line the extension module is compiled. Note that we linked the external library in the process - this was not done previously, which caused stated problems.

    f2py -m splib -h splib.fpy splib.f
    f2py -c splib splib.f -lfftw3

  • 1
    Note that FFTW3 may be not free enough for commercial redistribution of your code (it is GPL, not LGPL or BSD). Also, it is better to use the modern Fortran interface to it if you have no specific reasons against. – Vladimir F Героям слава Feb 12 '13 at 11:39
  • I agree on both things, thanks for pointing that out. Licencing restrictions will be included because of the FFTW3. – Johntra Volta Feb 12 '13 at 12:04