#include #define SWAP(a, b) tempr=(a); (a)=(b); (b)=tempr #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // Function void four1(float data[], int nn, int isign) {{{ /***************************************************************/ /* Replace `data' by its discrete Fourier transform, if `isign'is input as 1, or by its inverse discrete Fourier transform, if `isign' is input as -1. `data' is a complex array of length `nn', input as a real array data[1..2*nn]. `nn' MUST be an integer power of 2 (this is not checked for!?) */ void four1(float data[], int nn, int isign) { register int i, j, m, n; int mmax, istep; float wtemp, wr, wpr, wpi, wi, theta; float tempr, tempi; n= nn<<1; j=1; for (i=1; ii) { SWAP(data[j], data[i]); SWAP(data[j+1], data[i+1]); } m= n>>1; while (m >=2 &&j >m) { j -=m; m >>=1; } j +=m; } mmax =2; while (n> mmax) { istep= 2*mmax; theta= 6.28318530717959/(isign*mmax); wtemp= sin(.5*theta); wpr= -2.0*wtemp*wtemp; wpi= sin(theta); wr= 1.0; wi= 0.0; for (m=1; m