#include #include #include #include void ForwardFFT(const CircularArray<>& values,Complex<>* coeffs){ } void InverseFFT(const Complex<>* coeffs,CircularArray<>& values){ } int main(int argc,char* argv[]){ // Read the parameters in from the command line cmdLineString In; char* paramNames[]={"in"}; cmdLineReadable* params[]={&In}; cmdLineParse(argc-1,&argv[1],paramNames,sizeof(paramNames)/sizeof(char*),params); if(!In.set){ fprintf(stderr,"You must specify an input file\n"); return EXIT_FAILURE; } int res; float l2; CircularArray<> cIn,cOut; Complex<>* coeffs; // Read in the array cIn.read(In.value); res=cIn.resolution(); // Allocate space for the Fourier coefficients coeffs=new Complex<>[res]; // Run the forward and inverse Fourier transforms ForwardFFT(cIn,coeffs); InverseFFT(coeffs,cOut); // Correct for the scaling term for(int i=0;i::SquareDifference(cIn,cOut)); // Now compare the values of the Fourier coefficients (difference should be zero) FourierKey1D<> key; FourierTransform<> xForm; xForm.ForwardFourier(cIn,key); l2=0; float n=float(1.0/(2.0*PI))*key.resolution(); for(int i=0;i