mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
moved half-spectrum logic to Eigen::FFT
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user