Improving FFT performance in Python

后端 未结 6 884
独厮守ぢ
独厮守ぢ 2020-11-30 02:24

What is the fastest FFT implementation in Python?

It seems numpy.fft and scipy.fftpack both are based on fftpack, and not FFTW. Is fftpack as fast as FFTW? What abou

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 03:04

    Where I work some researchers have compiled this Fortran library which setups and calls the FFTW for a particular problem. This Fortran library (module with some subroutines) expect some input data (2D lists) from my Python program.

    What I did was to create a little C-extension for Python wrapping the Fortran library, where I basically calls "init" to setup a FFTW planner, and another function to feed my 2D lists (arrays), and a "compute" function.

    Creating a C-extensions is a small task, and there a lot of good tutorials out there for that particular task.

    To good thing about this approach is that we get speed .. a lot of speed. The only drawback is in the C-extension where we must iterate over the Python list, and extract all the Python data into a memory buffer.

提交回复
热议问题