#include #include #include "FFT.basic.h" using namespace std; /* * Print an array of complex numbers * If either the real or imaginary component of the * complex number is less than 1e-15, print it as zero. */ void print( complex *array, int n ) { for ( int i = 0; i < n; ++i ) { // Clean up any numbers which are close to zero // This is strictly for printing purposes complex z = array[i]; if ( abs( real( z ) ) < 1e-15 ) { z = complex( 0.0, imag( z ) ); } if ( abs( imag( z ) ) < 1e-15 ) { z = real( z ); } cout << z << " "; } cout << endl; } int const N = 8; int main() { complex z[N]; z[0] = 1.0; z[1] = 1.0; print( z, N ); Data_structures::Basic::FFT( z, N ); print( z, N ); Data_structures::Basic::iFFT( z, N ); print( z, N ); return 0; }