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