/* A program to time complex forward and inverse fast fourier transform routines */ void four1(float data[], unsigned long nn, int isign); #include #include #include #include #include "fftlib.h" #include "fftext.h" #if macintosh #include #endif #define NSIZES 3 /* the number of different ffts sizes to time */ typedef struct{ float Re; float Im; } Complex; void main(){ long fftSize[NSIZES] = {1024, 16384, 262144}; /* size of FFTs, must be powers of 2 */ long fftRepeats[NSIZES] = {2000, 50, 1}; /* number of timing loops */ Complex *a; long isize; long i1; long TheErr; long N; long M; #if macintosh UnsignedWide TheTime1; UnsignedWide TheTime2; double TheTime; #endif printf(" %6d Byte Floats \n", sizeof(a[0].Re)); for (isize = 0; isize < NSIZES; isize++){ N = fftSize[isize]; printf("ffts size = %7d, ", N); M = roundtol(LOG2(N)); TheErr = fftInit(M); if(!TheErr){ a = (Complex *) malloc(N*sizeof(Complex) ); if (a == 0) TheErr = 2; } if(!TheErr){ /* set up a simple test case */ for (i1=0; i1