Professional Documents
Culture Documents
Where
We can split the summation into two parts, one starting from j = 0 to j = = .
to j
, we arrive at an equivalent
We have successfully decomposed the original DFT into two separate summations essentially halving the problem set. By continuing to halve the problem, we can divide and conquer smaller problem sets. For n output elements, each element takes about log n calculations, the resultant running time is then ( ).
Appendix: Implementations
Serial Fast Fourier Transformation (Incomplete, Full Source Code Attached in Zip)
// Fast Fourier Implementation Using Iteration (Mimics Recursion) void iterativeFFT(complex *list, int size) { unsigned int n = size; complex *A; A = bitPermutation(list, N); int s; for (s = 0; s <= log2(n); ++s) { int m = exp2(s); complex omega_m; omega_m.real = cos(2 * PI / n); omega_m.imaginary = sin(2 * PI / n); int k; for (k = 0; k <= n-1; k += m) { complex omega; omega.real = 1; omega.imaginary = 0; int j; for (j = 0; j <= m/2-1; ++j) { complex t = multiplyComplex(omega, A[k+j+m/2]); complex u = A[k+j]; A[k+j] = addComplex(u,t); A[k+j+m/2] = subComplex(u,t); omega = multiplyComplex(omega, omega_m); } } } printArray(N, A); free(A); } int main() { // allocate complex structure arrays of size N complex *A = (complex*)malloc(sizeof(complex) * N); srand(SEED_VALUE); int i; for (i = 0; i < N; ++i) { A[i].real = rand() % CEILING_LIMIT; A[i].imaginary = rand() % CEILING_LIMIT; } printf("\n"); iterativeFFT(A, N); free(A); }