#include "kissfft.hh" #include #include #include #include static inline double curtime(void) { struct timeval tv; gettimeofday(&tv, NULL); return (double)tv.tv_sec + (double)tv.tv_usec*.000001; } using namespace std; template void dotest(int nfft) { typedef kissfft FFT; typedef std::complex cpx_type; cout << typeid(T).name() << ":nfft=" << nfft < inbuf(nfft); vector outbuf(nfft); #if 0 for (int k=0;k acc = 0; long double phinc = 2*k0* M_PIl / nfft; for (int k1=0;k1 x(inbuf[k1].real(),inbuf[k1].imag()); acc += x * exp( complex(0,-k1*phinc) ); } totalpower += norm(acc); complex x(outbuf[k0].real(),outbuf[k0].imag()); complex dif = acc - x; difpower += norm(dif); } cout << "RMSE:" << sqrt(difpower/totalpower) << "\t"; double t0 = curtime(); int nits=20e6/nfft; for (int k=0;k(32); dotest(32); dotest(32); dotest(1024); dotest(1024); dotest(1024); dotest(1800); dotest(1800); dotest(1800); return 0; }