#include #include #include #include #include #include #include #include "gsl_fft.hpp" #include using namespace std; typedef complex dtype ; void vector_out(ostream& stream, vector v){ vector::iterator vpos; stream< data(n,0.0); ofstream myfile("result"); // pulse: // begin nones+1 end-nones end //1 ------------------- ----------------- //0 ---------------------- transform(data.begin(),data.begin()+nones+1,data.begin(),bind2nd(plus(),1.0)); transform(data.end()-nones,data.end(),data.end()-nones,bind2nd(plus(),1.0)); cout<<"before fft :\n"; vector_out(cout,data); vector_out(myfile,data); myfile<(),sqrt(data.size()))); vector_out(cout,data); vector_out(myfile,data); // ---------------------- // backward FFT status = fft(data,-1); // ---------------------- if(status!=0){ cout << "fft fails\n"; return 1; } transform(data.begin(),data.end(),data.begin(),bind2nd(divides(),sqrt(data.size()))); cout<<"after backward fft (divided by sqrt(n)) :\n"; vector_out(cout,data); myfile.close(); return 0; }