complexFFTExample.cc

This is an example of how to use the class.

00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
00002    This file is part of the MFFM FFTw Wrapper library.
00003 
00004    MFFM MFFM FFTw Wrapper library is free software; you can 
00005    redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You have received a copy of the GNU General Public License
00016    along with the MFFM FFTw Wrapper library
00017 */
00018 #include <fstream>
00019 #include <iomanip>
00020 
00021 #include "complexFFT.H"
00022 #include <iomanip.h>
00023 
00024 int main (){
00025   int count =8;
00026   complexFFTData fftData(count);
00027   complexFFT fft(&fftData);
00028 
00029   for (int i=0;i<count;i++){
00030     c_re(fftData.in[i])=(double)i;
00031     //    fftData.in[i].im=(double)-i;
00032     c_im(fftData.in[i])=(double)i+5.0;
00033   }
00034 
00035   fftw_real *temp=&c_re(fftData.in[0]);
00036   for (int i=0; i<count; i++)
00037     cout << temp[i]<<endl;
00038   
00039 
00040   // forward transform :
00041   fft.fwdTransform();
00042   // inverse transform :
00043   fft.invTransform();
00044 
00045   //  for (int i=0; i<count; i++)
00046   //  cout << fftData.in[i].re<<' '<<fftData.in[i].im<<endl;
00047 
00048   // Find the power spectrum ...
00049   fftData.compPowerSpec();
00050   for (int i=0; i<count; i++)
00051     cout << fftData.power_spectrum[i]<<endl;
00052 }

Generated on Thu Oct 27 02:45:42 2005 for MFFM FFTw Wrapper by  doxygen 1.4.5