25 #include <queso/Fft.h> 
   26 #include <gsl/gsl_fft_complex.h> 
   33   const std::vector<std::complex<double> >& data,
 
   35         std::vector<std::complex<double> >& forwardResult)
 
   39   std::complex<double> z = data[0]; z += 0.; 
 
   40   unsigned int         f = fftSize; f += 1;  
 
   41   forwardResult[0] = 0.;                     
 
   43   if (forwardResult.size() != fftSize) {
 
   44     forwardResult.resize(fftSize,std::complex<double>(0.,0.));
 
   45     std::vector<std::complex<double> >(forwardResult).swap(forwardResult);
 
   48   std::vector<double> internalData(fftSize,0.);
 
   49   unsigned int minSize = std::min((
unsigned int) data.size(),fftSize);
 
   50   for (
unsigned int j = 0; j < minSize; ++j) {
 
   51     internalData[j] = data[j];
 
   54   gsl_fft_real_workspace* realWkSpace = gsl_fft_real_workspace_alloc(fftSize);
 
   55   gsl_fft_real_wavetable* realWvTable = gsl_fft_real_wavetable_alloc(fftSize);
 
   57   gsl_fft_real_transform(&internalData[0],
 
   63   gsl_fft_real_wavetable_free(realWvTable);
 
   64   gsl_fft_real_workspace_free(realWkSpace);
 
   66   unsigned int halfFFTSize = fftSize/2;
 
   67   double realPartOfFFT = 0.;
 
   68   double imagPartOfFFT = 0.;
 
   69   for (
unsigned int j = 0; j < internalData.size(); ++j) {
 
   71       realPartOfFFT = internalData[j];
 
   74     else if (j < halfFFTSize) {
 
   75       realPartOfFFT = internalData[2*j-1];
 
   76       imagPartOfFFT = internalData[2*j  ];
 
   78     else if (j == halfFFTSize) {
 
   79       realPartOfFFT = internalData[2*j-1];
 
   83       realPartOfFFT =  internalData[2*(fftSize-j)-1];
 
   84       imagPartOfFFT = -internalData[2*(fftSize-j)  ];
 
   86     forwardResult[j] = std::complex<double>(realPartOfFFT,imagPartOfFFT);
 
   95   const std::vector<std::complex<double> >& data,
 
   97         std::vector<std::complex<double> >& inverseResult)
 
   99   if (inverseResult.size() != fftSize) {
 
  100     inverseResult.resize(fftSize,std::complex<double>(0.,0.));
 
  101     std::vector<std::complex<double> >(inverseResult).swap(inverseResult);
 
  104   std::vector<double> internalData(2*fftSize,0.);                          
 
  105   unsigned int minSize = 2 * std::min((
unsigned int) data.size(),fftSize); 
 
  106   for (
unsigned int j = 0; j < minSize; ++j) {
 
  107     internalData[2*j  ] = data[j].real();
 
  108     internalData[2*j+1] = data[j].imag();
 
  111   gsl_fft_complex_workspace* complexWkSpace = gsl_fft_complex_workspace_alloc(fftSize);
 
  112   gsl_fft_complex_wavetable* complexWvTable = gsl_fft_complex_wavetable_alloc(fftSize);
 
  114   gsl_fft_complex_inverse(&internalData[0],
 
  120   gsl_fft_complex_wavetable_free(complexWvTable);
 
  121   gsl_fft_complex_workspace_free(complexWkSpace);
 
  123   for (
unsigned int j = 0; j < fftSize; ++j) {
 
  124     inverseResult[j] = std::complex<double>(internalData[2*j],internalData[2*j+1]);
 
#define queso_not_implemented()
 
Class for a Fast Fourier Transform (FFT) algorithm.