From 8f51a4ac9005c29fe99d3c1f70b99853be2a9f15 Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Tue, 16 Feb 2010 20:44:48 -0500 Subject: found out about little-documented FFTW_PRESERVE_INPUT which has effect on c2r transforms --- unsupported/test/FFT.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'unsupported/test/FFT.cpp') diff --git a/unsupported/test/FFT.cpp b/unsupported/test/FFT.cpp index 056be2ef3..02cd5a48f 100644 --- a/unsupported/test/FFT.cpp +++ b/unsupported/test/FFT.cpp @@ -1,3 +1,5 @@ +#if 0 + // This file is part of Eigen, a lightweight C++ template library // for linear algebra. Eigen itself is part of the KDE project. // @@ -25,7 +27,11 @@ #include "main.h" #include +template +std::complex RandomCpx() { return std::complex( (T)(rand()/(T)RAND_MAX - .5), (T)(rand()/(T)RAND_MAX - .5) ); } + using namespace std; +using namespace Eigen; float norm(float x) {return x*x;} double norm(double x) {return x*x;} @@ -39,17 +45,16 @@ complex promote(double x) { return complex( x); } complex promote(long double x) { return complex( x); } - template - long double fft_rmse( const VectorType1 & fftbuf,const VectorType2 & timebuf) + template + long double fft_rmse( const vector & fftbuf,const vector & timebuf) { long double totalpower=0; long double difpower=0; - cerr <<"idx\ttruth\t\tvalue\t|dif|=\n"; - long double pi = acos((long double)-1); - for (int k0=0;k0 acc = 0; long double phinc = -2.*k0* pi / timebuf.size(); - for (int k1=0;k1(0,k1*phinc) ); } totalpower += norm(acc); @@ -62,13 +67,13 @@ complex promote(long double x) { return complex( x); return sqrt(difpower/totalpower); } - template - long double dif_rmse( const VectorType1& buf1,const VectorType2& buf2) + template + long double dif_rmse( const vector buf1,const vector buf2) { long double totalpower=0; long double difpower=0; - int n = min( buf1.size(),buf2.size() ); - for (int k=0;k(2*3*4*5*7) ); CALL_SUBTEST( test_scalar(2*3*4*5*7) ); } +#else +#define test_FFTW test_FFT +#include "FFTW.cpp" +#endif -- cgit v1.2.3