#include #include "nr.h" using namespace std; void NR::four1(Vec_IO_DP &data, const int isign) { int n,mmax,m,j,istep,i; DP wtemp,wr,wpr,wpi,wi,theta,tempr,tempi; int nn=data.size()/2; n=nn << 1; j=1; for (i=1;i i) { SWAP(data[j-1],data[i-1]); SWAP(data[j],data[i]); } m=nn; while (m >= 2 && j > m) { j -= m; m >>= 1; } j += m; } mmax=2; while (n > mmax) { istep=mmax << 1; theta=isign*(6.28318530717959/mmax); wtemp=sin(0.5*theta); wpr = -2.0*wtemp*wtemp; wpi=sin(theta); wr=1.0; wi=0.0; for (m=1;m