Changeset 3089 in Sophya for trunk/SophyaProg/Tests/tfft.cc
- Timestamp:
- Oct 11, 2006, 12:58:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/tfft.cc
r3077 r3089 11 11 #include "fftpserver.h" 12 12 #include "fftmserver.h" 13 #include "fftmayer.h" 13 14 #include "fftwserver.h" 14 15 #include "ntoolsinit.h" … … 48 49 static int prtlev = 0; 49 50 51 //------------------------------------------------- 50 52 template <class T> 51 53 void TestFFTPack(T seuil, sa_size_t num) … … 106 108 } 107 109 110 //------------------------------------------------- 108 111 template <class T> 109 112 int TestFFTS(T seuil, FFTServerInterface & ffts, sa_size_t num) … … 197 200 } 198 201 199 200 201 202 202 inline void MayerFFTForw(r_4* d, int sz) { 203 fht_r4(d, sz); 204 } 205 inline void MayerFFTForw(r_8* d, int sz) { 206 fht_r8(d, sz); 207 } 208 209 //------------------------------------------------- 210 template <class T> 211 int MultiFFTTest(T t, sa_size_t sz, int nloop, bool fgp) 212 { 213 cout <<" ===> MultiFFTTest<T=r_" << sizeof(T) << "> NLoop= " << nloop << " ArrSz= " << sz << endl; 214 TVector< T > in(sz), incopie(sz); 215 216 incopie = in = RandomSequence(); 217 FFTPackServer fftp(false); 218 TVector< complex<T> > outc; 219 220 PrtTim("MultiFFT-LoopStart"); 221 222 if (fgp) { 223 cout << " --- Test effectue avec FFTPack " << endl; 224 for(int kk=0; kk<nloop; kk++) { 225 in = incopie; 226 // fftp.FFTForward(in, outc); 227 fftp.fftf(sz, in.Data()); 228 } 229 } 230 else { 231 cout << " --- Test effectue avec FFTMayer " << endl; 232 for(int kk=0; kk<nloop; kk++) { 233 in = incopie; 234 // in += 0.01; 235 MayerFFTForw(in.Data(), sz); 236 } 237 } 238 PrtTim("MultiFFT-LoopEnd"); 239 cout << " ----- End ---- MultiFFTTest<T> ----" << endl; 240 return 0; 241 } 242 243 244 245 //------------------------------------------------- 246 //------------------------------------------------- 247 //------------------------------------------------- 203 248 int main(int narg, char* arg[]) 204 249 { … … 209 254 if (narg < 3) { 210 255 cout << "tfft/ args error - \n Usage tfft size p/P/M/W [f/d/F/D PrtLev=0 MaxNPrt=50 diffthr] \n" 256 << " OR tfft size P/M FL/DL/FZ/DZ [NFFT=10] \n" 211 257 << " 1D real/complex-FFT test (FFTServer) \n" 212 258 << " size: input vector length \n " 213 259 << " p=FFTPackTest P=FFTPack, M=FFTMayer, W= FFTWServer \n " 214 260 << " F/f:float, D/d:double F/D:random in_vector (default=D) \n" 215 << " diffthr : Threshold for diff checks (=10^-6/10^-4 double/float)" << endl; 261 << " FL/DL : perform NFFT on a serie of float[size] or double[size] " 262 << " FZ/DZ : perform NFFT on a series of complex<float>[size] or complex<double>[size] " 263 << " diffthr : Threshold for diff checks (=10^-6/10^-4 double/float)" 264 << endl; 216 265 return(1); 217 266 } … … 239 288 dtyp = toupper(dtyp); 240 289 290 241 291 FFTServerInterface * ffts; 242 292 if (*arg[2] == 'M') ffts = fftm.Clone(); 243 293 else if (*arg[2] == 'W') ffts = fftw.Clone(); 244 294 else ffts = fftp.Clone(); 295 296 int nloop = 0; 297 bool fgpack = true; 298 if (arg[3][1] == 'L') { // MultiFFT test 299 nloop = 10; 300 if (narg > 4) nloop = atoi(arg[4]); 301 if (*arg[2] == 'M') fgpack = false; 302 } 303 245 304 246 305 cout << "\n ============================================= \n" … … 255 314 cout << " ------ Testing FFTServer for double (r_8)----- " << endl; 256 315 if (*arg[2] == 'p') TestFFTPack(ds, sz); 316 else if (nloop > 0) rc = MultiFFTTest(ds, sz, nloop, fgpack); 257 317 else rc = TestFFTS(ds, *ffts, sz); 258 318 } … … 260 320 cout << " ------ Testing FFTServer for float (r_4)----- " << endl; 261 321 if (*arg[2] == 'p') TestFFTPack(fs, sz); 322 else if (nloop > 0) rc = MultiFFTTest(fs, sz, nloop, fgpack); 262 323 else rc = TestFFTS(fs, *ffts, sz); 263 324 }
Note:
See TracChangeset
for help on using the changeset viewer.