且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

提高 Python 中的 FFT 性能

更新时间:2023-02-27 13:15:37

您当然可以使用 Cython 或其他允许您访问外部库的类似工具来包装您想要测试的任何 FFT 实现.

You could certainly wrap whatever FFT implementation that you wanted to test using Cython or other like-minded tools that allow you to access external libraries.

如果您要测试 FFT 实现,您还可以查看基于 GPU 的代码(如果您可以访问适当的硬件).有几个:reikna.fftscikits.cuda.

If you're going to test FFT implementations, you might also take a look at GPU-based codes (if you have access to the proper hardware). There are several: reikna.fft, scikits.cuda.

还有一个基于 CPU 的 python FFTW 包装器 pyFFTW.

There's also a CPU based python FFTW wrapper pyFFTW.

(也有 pyFFTW3,但它不像 pyFFTW 那样积极维护,并且它不适用于 Python3.(source))

(There is pyFFTW3 as well, but it is not so actively maintained as pyFFTW, and it does not work with Python3. (source))

我对这些都没有经验.如果速度对您很重要,那么您可能需要为您的特定应用程序进行一些挖掘和基准测试.

I don't have experience with any of these. It's probably going to fall to you to do some digging around and benchmark different codes for your particular application if speed is important to you.