C++ 快速傅立叶变换

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5255474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 17:46:18  来源:igfitidea点击:

Fast Fourier Transform

c++csignal-processingfftdft

提问by Nikhil Garg

I need to multiply two polynomials each having small integral coefficients. I need a fast FFT routine in C/C++ which can convolve them. I have seen several libraries but they seem to be too large spread over multiple files. What is important is I need code which is not too long and can be very easily used and compiled in a single .c/.cppfile.

我需要将两个多项式相乘,每个多项式的积分系数都很小。我需要一个可以对它们进行卷积的 C/C++ 中的快速 FFT 例程。我见过几个库,但它们似乎太大,分布在多个文件中。重要的是我需要的代码不会太长,并且可以很容易地在单个.c/.cpp文件中使用和编译。

  1. FFT should be optimized for real inputs at least if not small integers.
  2. Radix 4 implementation if available would be fine too.
  3. Compiling it should take no special compilation flags as compilation of program has to be done in external environment which I can't control.
  1. FFT 至少应该针对实际输入进行优化,如果不是小整数的话。
  2. 如果可用,Radix 4 实现也可以。
  3. 编译它应该不需要特殊的编译标志,因为程序的编译必须在我无法控制的外部环境中完成。

One that very well matches my needs is here. But I need something twice as fast.

非常符合我的需求的一款就在这里。但我需要两倍的速度。

回答by Paul R

For a straightforward and easy to use FFT implementation try KissFFT. If you need absolute maximum performance though, and don't mind a little complexity, then it has to be FFTW.

对于简单易用的 FFT 实现,请尝试KissFFT。如果您需要绝对的最大性能,并且不介意有点复杂,那么它必须是FFTW

回答by LnxPrgr3

I've adapted the smbFftfunction from this example on DspDimensionto my needs in the past.

过去,我已经根据我的需要调整了DspDimensionsmbFft示例中的函数。

回答by Andrew

I've collected some of my top search results that fit or mostly fit the question (C/C++ FFT), and I've generally organized them from simple to complex:

我收集了一些适合或大部分适合问题(C/C++ FFT)的热门搜索结果,并且我通常将它们从简单到复杂组织起来:

Feel free to add to or update the list.

随意添加或更新列表。