aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/FFT.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unsupported/test/FFT.cpp')
-rw-r--r--unsupported/test/FFT.cpp35
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>