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