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 <string.h> 00019 #include "real2DFFT.H" 00020 #include <iomanip.h> 00021 using namespace std; 00022 00023 int main(void){ 00024 int x=8, y=8; 00025 real2DFFTData *fftData = new real2DFFTData(x,y); 00026 real2DFFT *fft= new real2DFFT(fftData); 00027 00028 // clear the data 00029 fftData->clearInput(); 00030 fftData->clearOutput(); 00031 00032 int temp=x/2, temp2=y/2; 00033 for (int j=0;j<x;j++) 00034 fftData->in[temp2+j*x]=10000.0; 00035 for (int j=0;j<y;j++) 00036 fftData->in[temp*y+j]=10000.0; 00037 // fftData->in[temp*y+(y-1)/2]=20000.0; 00038 00039 for (int i=0;i<fftData->getXSize();i++){ 00040 for (int j=0;j<fftData->getYSize();j++) 00041 cout<<fftData->in[i*x+j]<<'\t'; 00042 cout<<endl; 00043 } 00044 cout<<'\n'<<endl; 00045 fft->fwdTransform(); 00046 fftData->reScale(); 00047 fftData->compPowerSpec(); 00048 fft->invTransform(); 00049 00050 for (int i=0;i<fftData->getXSize();i++){ 00051 for (int j=0;j<fftData->getYSize();j++) 00052 cout<<fftData->in[i*x+j]<<'\t'; 00053 cout<<endl; 00054 } 00055 cout<<'\n'<<endl; 00056 /* for (int i=0;i<fftData.getXSize();i++){ 00057 for (int j=0;j<fftData.getYHalfSize();j++) 00058 cout<<fftData.out[i][j].im<<'\t'; 00059 cout<<endl; 00060 }*/ 00061 for (int i=0;i<x;i++){ 00062 for (int j=0;j<y/2+1;j++) 00063 cout<<fftData->power[i*(y/2+1)+j]<<'\t'; 00064 cout<<endl; 00065 } 00066 delete fftData; 00067 delete fft; 00068 }