diff options
author | Mark Borgerding <mark@borgerding.net> | 2009-10-30 23:38:13 -0400 |
---|---|---|
committer | Mark Borgerding <mark@borgerding.net> | 2009-10-30 23:38:13 -0400 |
commit | 4c3345364e079429dcfc17da63364ee75b9c0636 (patch) | |
tree | c76f0e6e8e5f51700db9de8f3a76cee9f62e7b28 /unsupported/test/FFT.cpp | |
parent | d659fd9b148870e3c1e367139bec388142f2818e (diff) |
moved half-spectrum logic to Eigen::FFT
Diffstat (limited to 'unsupported/test/FFT.cpp')
-rw-r--r-- | unsupported/test/FFT.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/unsupported/test/FFT.cpp b/unsupported/test/FFT.cpp index cc68f3718..ad0d426e4 100644 --- a/unsupported/test/FFT.cpp +++ b/unsupported/test/FFT.cpp @@ -101,12 +101,34 @@ void test_scalar_generic(int nfft) ComplexVector outbuf; for (int k=0;k<nfft;++k) inbuf[k]= (T)(rand()/(double)RAND_MAX - .5); + + // make sure it DOESN'T give the right full spectrum answer + // if we've asked for half-spectrum + fft.SetFlag(fft.HalfSpectrum ); + fft.fwd( outbuf,inbuf); + VERIFY(outbuf.size() == (nfft>>1)+1); + VERIFY( fft_rmse(outbuf,inbuf) < test_precision<T>() );// gross check + + fft.ClearFlag(fft.HalfSpectrum ); fft.fwd( outbuf,inbuf); VERIFY( fft_rmse(outbuf,inbuf) < test_precision<T>() );// gross check ScalarVector buf3; fft.inv( buf3 , outbuf); VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check + + // verify that the Unscaled flag takes effect + ComplexVector buf4; + fft.SetFlag(fft.Unscaled); + fft.inv( buf4 , outbuf); + for (int k=0;k<nfft;++k) + buf4[k] *= T(1./nfft); + VERIFY( dif_rmse(inbuf,buf4) < test_precision<T>() );// gross check + + // verify that ClearFlag works + fft.ClearFlag(fft.Unscaled); + fft.inv( buf3 , outbuf); + VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check } template <typename T> @@ -136,6 +158,19 @@ void test_complex_generic(int nfft) fft.inv( buf3 , outbuf); VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check + + // verify that the Unscaled flag takes effect + ComplexVector buf4; + fft.SetFlag(fft.Unscaled); + fft.inv( buf4 , outbuf); + for (int k=0;k<nfft;++k) + buf4[k] *= T(1./nfft); + VERIFY( dif_rmse(inbuf,buf4) < test_precision<T>() );// gross check + + // verify that ClearFlag works + fft.ClearFlag(fft.Unscaled); + fft.inv( buf3 , outbuf); + VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check } template <typename T> |