From 59bf2774a3ca00c1f521683d514bab7bc140b70e Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 8 Jul 2016 11:38:11 +0200 Subject: [PATCH] Fix warnings --- unsupported/test/FFTW.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/unsupported/test/FFTW.cpp b/unsupported/test/FFTW.cpp index 1dd6dc97d..8b7528fb7 100644 --- a/unsupported/test/FFTW.cpp +++ b/unsupported/test/FFTW.cpp @@ -18,11 +18,11 @@ using namespace Eigen; template < typename T> -complex promote(complex x) { return complex(x.real(),x.imag()); } +complex promote(complex x) { return complex((long double)x.real(),(long double)x.imag()); } -complex promote(float x) { return complex( x); } -complex promote(double x) { return complex( x); } -complex promote(long double x) { return complex( x); } +complex promote(float x) { return complex((long double)x); } +complex promote(double x) { return complex((long double)x); } +complex promote(long double x) { return complex((long double)x); } template @@ -33,7 +33,7 @@ complex promote(long double x) { return complex( x); long double pi = acos((long double)-1 ); for (size_t k0=0;k0<(size_t)fftbuf.size();++k0) { complex acc = 0; - long double phinc = -2.*k0* pi / timebuf.size(); + long double phinc = (long double)(-2.)*k0* pi / timebuf.size(); for (size_t k1=0;k1<(size_t)timebuf.size();++k1) { acc += promote( timebuf[k1] ) * exp( complex(0,k1*phinc) ); } @@ -54,8 +54,8 @@ complex promote(long double x) { return complex( x); long double difpower=0; size_t n = (min)( buf1.size(),buf2.size() ); for (size_t k=0;k>1)+1) ); - VERIFY( fft_rmse(freqBuf,tbuf) < test_precision() );// gross check + VERIFY( T(fft_rmse(freqBuf,tbuf)) < test_precision() );// gross check fft.ClearFlag(fft.HalfSpectrum ); fft.fwd( freqBuf,tbuf); VERIFY( (size_t)freqBuf.size() == (size_t)nfft); - VERIFY( fft_rmse(freqBuf,tbuf) < test_precision() );// gross check + VERIFY( T(fft_rmse(freqBuf,tbuf)) < test_precision() );// gross check if (nfft&1) return; // odd FFTs get the wrong size inverse FFT ScalarVector tbuf2; fft.inv( tbuf2 , freqBuf); - VERIFY( dif_rmse(tbuf,tbuf2) < test_precision() );// gross check + VERIFY( T(dif_rmse(tbuf,tbuf2)) < test_precision() );// gross check // verify that the Unscaled flag takes effect @@ -121,12 +121,12 @@ void test_scalar_generic(int nfft) //for (size_t i=0;i<(size_t) tbuf.size();++i) // cout << "freqBuf=" << freqBuf[i] << " in2=" << tbuf3[i] << " - in=" << tbuf[i] << " => " << (tbuf3[i] - tbuf[i] ) << endl; - VERIFY( dif_rmse(tbuf,tbuf3) < test_precision() );// gross check + VERIFY( T(dif_rmse(tbuf,tbuf3)) < test_precision() );// gross check // verify that ClearFlag works fft.ClearFlag(fft.Unscaled); fft.inv( tbuf2 , freqBuf); - VERIFY( dif_rmse(tbuf,tbuf2) < test_precision() );// gross check + VERIFY( T(dif_rmse(tbuf,tbuf2)) < test_precision() );// gross check } template @@ -152,10 +152,10 @@ void test_complex_generic(int nfft) inbuf[k]= Complex( (T)(rand()/(double)RAND_MAX - .5), (T)(rand()/(double)RAND_MAX - .5) ); fft.fwd( outbuf , inbuf); - VERIFY( fft_rmse(outbuf,inbuf) < test_precision() );// gross check + VERIFY( T(fft_rmse(outbuf,inbuf)) < test_precision() );// gross check fft.inv( buf3 , outbuf); - VERIFY( dif_rmse(inbuf,buf3) < test_precision() );// gross check + VERIFY( T(dif_rmse(inbuf,buf3)) < test_precision() );// gross check // verify that the Unscaled flag takes effect ComplexVector buf4; @@ -163,12 +163,12 @@ void test_complex_generic(int nfft) fft.inv( buf4 , outbuf); for (int k=0;k() );// gross check + VERIFY( T(dif_rmse(inbuf,buf4)) < test_precision() );// gross check // verify that ClearFlag works fft.ClearFlag(fft.Unscaled); fft.inv( buf3 , outbuf); - VERIFY( dif_rmse(inbuf,buf3) < test_precision() );// gross check + VERIFY( T(dif_rmse(inbuf,buf3)) < test_precision() );// gross check } template