#ifndef GSL_FFT_HPP #define GSL_FFT_HPP // Use data: either std::vector or std::valarray or armadillo vector #include #include template int fft(T& data, int direction){ int status; const size_t stride=1; size_t n; #ifdef ARMA n=data.n_elem; // Armadillo data has no member size, use nelem #else n = data.size(); #endif double* pdata = reinterpret_cast (&data[0]); if(direction>0){ status = gsl_fft_complex_radix2_forward(pdata, stride, n); } else { status = gsl_fft_complex_radix2_backward(pdata, stride, n); } if(status!=GSL_SUCCESS) return 1; return 0; } #endif