From e5c91b4e9553401392c0cb39e9a479e11cc582df Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Wed, 2 Dec 2009 17:23:09 -0500 Subject: [PATCH 1/4] removed troublesome M_PI and M_PIl constants --- unsupported/test/FFT.cpp | 7 ++----- unsupported/test/FFTW.cpp | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/unsupported/test/FFT.cpp b/unsupported/test/FFT.cpp index 4a6d495cc..3e4126522 100644 --- a/unsupported/test/FFT.cpp +++ b/unsupported/test/FFT.cpp @@ -45,13 +45,10 @@ complex promote(long double x) { return complex( x); long double totalpower=0; long double difpower=0; cerr <<"idx\ttruth\t\tvalue\t|dif|=\n"; + long double pi = acos(-1); for (size_t k0=0;k0 acc = 0; -#ifdef _GNU_SOURCE - long double phinc = -2.*k0* M_PIl / timebuf.size(); -#else - long double phinc = -2.*k0* M_PI / timebuf.size(); -#endif + long double phinc = -2.*k0* pi / timebuf.size(); for (size_t k1=0;k1(0,k1*phinc) ); } diff --git a/unsupported/test/FFTW.cpp b/unsupported/test/FFTW.cpp index cf7be75aa..fdb41f2e0 100644 --- a/unsupported/test/FFTW.cpp +++ b/unsupported/test/FFTW.cpp @@ -45,10 +45,11 @@ complex promote(long double x) { return complex( x); { long double totalpower=0; long double difpower=0; + long double pi = acos(-1); cerr <<"idx\ttruth\t\tvalue\t|dif|=\n"; for (size_t k0=0;k0 acc = 0; - long double phinc = -2.*k0* M_PIl / timebuf.size(); + long double phinc = -2.*k0* pi / timebuf.size(); for (size_t k1=0;k1(0,k1*phinc) ); } From 012cd62c81af01c6089d57871d492636b843e4a5 Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Wed, 2 Dec 2009 22:58:34 -0500 Subject: [PATCH 2/4] explicitly cast to use the acos(long double) --- unsupported/test/FFT.cpp | 2 +- unsupported/test/FFTW.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unsupported/test/FFT.cpp b/unsupported/test/FFT.cpp index 3e4126522..b029ba655 100644 --- a/unsupported/test/FFT.cpp +++ b/unsupported/test/FFT.cpp @@ -45,7 +45,7 @@ complex promote(long double x) { return complex( x); long double totalpower=0; long double difpower=0; cerr <<"idx\ttruth\t\tvalue\t|dif|=\n"; - long double pi = acos(-1); + long double pi = acos((long double)-1); for (size_t k0=0;k0 acc = 0; long double phinc = -2.*k0* pi / timebuf.size(); diff --git a/unsupported/test/FFTW.cpp b/unsupported/test/FFTW.cpp index fdb41f2e0..c182cab9d 100644 --- a/unsupported/test/FFTW.cpp +++ b/unsupported/test/FFTW.cpp @@ -45,7 +45,7 @@ complex promote(long double x) { return complex( x); { long double totalpower=0; long double difpower=0; - long double pi = acos(-1); + long double pi = acos((long double)-1 ); cerr <<"idx\ttruth\t\tvalue\t|dif|=\n"; for (size_t k0=0;k0 acc = 0; From af17770680f23fe3d858cb461b4983795f7e8810 Mon Sep 17 00:00:00 2001 From: bjornpiltz Date: Thu, 3 Dec 2009 09:27:15 +0100 Subject: [PATCH 3/4] Fix compilation for MSVC. --- unsupported/Eigen/src/NumericalDiff/NumericalDiff.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h index 98872e0bc..db6f791df 100644 --- a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +++ b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h @@ -45,10 +45,11 @@ enum NumericalDiffMode { * * Currently only "Forward" and "Central" scheme are implemented. */ -template -class NumericalDiff : public Functor +template +class NumericalDiff : public _Functor { public: + typedef _Functor Functor; typedef typename Functor::Scalar Scalar; typedef typename Functor::InputType InputType; typedef typename Functor::ValueType ValueType; From ffaea19a70d22657008645e97a0b9efe2fcc9451 Mon Sep 17 00:00:00 2001 From: Marton Danoczy Date: Thu, 3 Dec 2009 14:01:34 +0100 Subject: [PATCH 4/4] Fixed compilation warnings in MSVC with Scalar==float --- unsupported/Eigen/src/FFT/ei_kissfft_impl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h index 5c958d1ec..2dff2bd00 100644 --- a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h +++ b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h @@ -160,7 +160,7 @@ struct ei_kiss_cpx_fft scratch[0]=scratch[1]-scratch[2]; tw1 += fstride; tw2 += fstride*2; - Fout[m] = Complex( Fout->real() - .5*scratch[3].real() , Fout->imag() - .5*scratch[3].imag() ); + Fout[m] = Complex( Fout->real() - Scalar(.5)*scratch[3].real() , Fout->imag() - Scalar(.5)*scratch[3].imag() ); scratch[0] *= epi3.imag(); *Fout += scratch[3]; Fout[m2] = Complex( Fout[m].real() + scratch[0].imag() , Fout[m].imag() - scratch[0].real() ); @@ -377,10 +377,10 @@ struct ei_kissfft_impl std::vector m_tmpBuf2; inline - int PlanKey(int nfft,bool isinverse) const { return (nfft<<1) | isinverse; } + int PlanKey(int nfft, bool isinverse) const { return (nfft<<1) | int(isinverse); } inline - PlanData & get_plan(int nfft,bool inverse) + PlanData & get_plan(int nfft, bool inverse) { // TODO look for PlanKey(nfft, ! inverse) and conjugate the twiddles PlanData & pd = m_plans[ PlanKey(nfft,inverse) ]; @@ -400,7 +400,7 @@ struct ei_kissfft_impl int ncfft= ncfft2<<1; Scalar pi = acos( Scalar(-1) ); for (int k=1;k<=ncfft2;++k) - twidref[k-1] = exp( Complex(0,-pi * ((double) (k) / ncfft + .5) ) ); + twidref[k-1] = exp( Complex(0,-pi * (Scalar(k) / ncfft + Scalar(.5)) ) ); } return &twidref[0]; }