DFT
IDFT
FFT
1 当输入向量长度为2^k时
参考wiki FFT有如下代码
/// <summary>
/// Cooley–Tukey FFT algorithm,
/// length of <paramref name="data"/> is power of 2.
/// <paramref name="left"/> is inclusive, <paramref name="right"/> is exclusive.
/// </summary>
private static void CooleyTukey(Complex[] data, int left, int right, int exponentSign)
{
if (left + 1 < right)
{
Separate(data, left, right);
var half = (right - left) >> 1;
CooleyTukey(data, left, left + half, exponentSign); // recurse even items
CooleyTukey(data, left + half, right, exponentSign); // recurse odd items
for (var k = 0; k < half; k++)// combine results of two half recursions
{
var even = data[left + k]; // even
var odd = data[left + k + half]; // odd
var t = 2 * Math.PI * exponentSign * k / (right - left);
var tmp = new Complex(Math.Cos(t), Math.Sin(t)) * odd; // "twiddle-factor" w*odd