summaryrefslogtreecommitdiff
path: root/src/signalProcessing/fft/testDoubleFft.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/signalProcessing/fft/testDoubleFft.c')
-rw-r--r--src/signalProcessing/fft/testDoubleFft.c95
1 files changed, 94 insertions, 1 deletions
diff --git a/src/signalProcessing/fft/testDoubleFft.c b/src/signalProcessing/fft/testDoubleFft.c
index a55c3f20..374071ae 100644
--- a/src/signalProcessing/fft/testDoubleFft.c
+++ b/src/signalProcessing/fft/testDoubleFft.c
@@ -20,6 +20,7 @@
#define COLS4 4
#define COLS8 8
#define COLS16 16
+#define COLS32 32
#define ZREAL_IN2 { 0.00022113462910056 , 0.33032709173858166 }
#define ZIMAG_IN2 { 0.66538110421970487 , 0.62839178834110498 }
@@ -43,6 +44,24 @@
0.11213546665385365, 0.68568959552794695, 0.15312166837975383, 0.69708506017923355}
+#define ZREAL_IN32 {0.21132486546412110,0.75604385416954756,0.00022113462910056,0.33032709173858166,\
+ 0.66538110421970487,0.62839178834110498,0.84974523587152362,0.68573101982474327,\
+ 0.87821648130193353,0.06837403681129217,0.56084860628470778,0.66235693730413914,\
+ 0.72635067673400044,0.19851438421756029,0.54425731627270579,0.23207478970289230,\
+ 0.23122371966019273,0.21646326314657927,0.88338878145441413,0.65251349471509457,\
+ 0.30760907428339124,0.93296162132173777,0.21460078610107303,0.31264199689030647,\
+ 0.36163610080257058,0.2922266637906432 ,0.56642488157376647,0.48264719732105732,\
+ 0.33217189135029912,0.59350947011262178,0.50153415976092219,0.43685875833034515}
+
+#define ZIMAG_IN32 {0.26931248093023896,0.63257448654621840,0.40519540151581168,0.91847078315913677,\
+ 0.04373343335464597,0.48185089323669672,0.26395560009405017,0.41481037065386772,\
+ 0.28064980218186975,0.12800584640353918,0.77831285959109664,0.21190304495394230,\
+ 0.11213546665385365,0.68568959552794695,0.15312166837975383,0.69708506017923355,\
+ 0.84155184263363481,0.40620247554033995,0.40948254754766822,0.87841258011758327,\
+ 0.11383596854284406,0.19983377400785685,0.56186607433483005,0.58961773291230202,\
+ 0.68539796629920602,0.89062247332185507,0.50422128057107329,0.34936154074966908,\
+ 0.38737787725403905,0.92228986788541079,0.94881842611357570,0.34353372454643250}
+
#define ZREAL_RESULT2 { 0.33054822636768222,- 0.33010595710948110}
#define ZIMAG_RESULT2 { 1.29377289256080985, 0.03698931587859988}
@@ -64,6 +83,25 @@
-1.86397336795926094,-1.03154071610913434,-0.48573205481665604, 0.44539904220706855,\
-0.74425477534532547,-0.54299368721281471, 0.37996440777257234, 1.11249504536330601}
+#define ZREAL_RESULT32 { 15.3165711835026741,-1.79021577127059173,-1.66659611407065089, 0.17525916470909797,\
+ -1.16958628014871602, 0.58684741669397522, 0.03947542161511042, 0.99740008842981942,\
+ -0.46323241293430328, 2.122539701124051 ,-1.52963914564883940, 0.87990417229605744,\
+ 0.58569127383151542,-0.18198535589432135, 0.26043384746900655,-1.11204765363415392,\
+ 0.35329844802618027,-1.47568616310628631,-2.03487116744967844,-3.19495610958970166,\
+ 0.81026376203844086,-0.46366666776372734,-1.63150209835186510, 0.77334707088593369,\
+ -0.35098156332969666,-1.63498270669406387, 0.67411467120679691, 2.80538085483913147,\
+ -1.62281507315555107,-0.5600265995962992 ,-0.48984739061140237, 1.75450689143393301}
+
+
+
+#define ZIMAG_RESULT32 { 15.509232945740223 ,-0.47962381296807621, 0.21213951866464975, 0.88442937061831350,\
+ 1.52924554070524898,-0.6313403060045536 ,-2.25908603874729419,-1.3836292677373856 ,\
+ -1.18231281638145447,-2.14767090006699668, 1.5452016553381984 ,-3.15355126536920993,\
+ 2.10199273301496747, 0.67530605269461363,-2.03603600735261558, 1.2309547869577584 ,\
+ -1.9912955537438393 ,-1.9668221895811833 , 0.29575245179739662, 1.34815224953105273,\
+ 1.508921339902356 ,-0.40084285801706099, 2.96716476331614754, 1.08125713762201059,\
+ -1.39964522421360016,-1.30777696073860294,-1.13169784714423916,-2.00872755010475013,\
+ 0.53915777133569487,-2.45178696294021004 , 1.56509394479014063, 1.5558426888499468}
static void zfftmaTest2 (void )
{
@@ -262,6 +300,60 @@ static void zfftmaTest16 (void )
}
+static void zfftmaTest32 (void )
+{
+ int i = 0 ;
+
+ double tRealIn [] = ZREAL_IN32;
+ double tImagIn [] = ZIMAG_IN32 ;
+
+
+
+ double tRealResult [] = ZREAL_RESULT32 ;
+ double tImagResult [] = ZIMAG_RESULT32 ;
+
+
+
+ doubleComplex* out = (doubleComplex*) malloc ( sizeof(doubleComplex) * (unsigned int) (ROW*COLS32));
+ doubleComplex* in = DoubleComplexMatrix ( tRealIn , tImagIn , ROW*COLS32 );
+
+
+
+ zfftma ( in , ROW , COLS32 , out );
+
+
+
+
+ /* if we don't add that test assert failed if result = 0 'cause then we have |(out - 0)|/|out| = 1*/
+ for ( i = 0 ; i < (ROW*COLS32 ) ; i++ )
+ {
+
+
+ printf ( "\t\t %d out : %e\t %e\t * i result : %e\t %e\t * i assert : : %e\t %e\t * i \n" ,
+ i ,
+ zreals(out[i]) ,
+ zimags(out[i]),
+ tRealResult[i] ,
+ tImagResult[i],
+ fabs( zreals(out[i]) - tRealResult[i] ) / fabs (zreals (out[i])) ,
+ fabs( zimags(out[i]) - tImagResult[i] ) / fabs (zimags (out[i])));
+
+
+ if ( zreals(out[i]) < 1e-14 && tRealResult[i] < 1e-18 )
+ assert ( 1 ) ;
+ else
+ assert ( fabs( zreals(out[i]) - tRealResult[i] ) / fabs (zreals (out[i])) < 1e-12 );
+
+
+ if ( zimags(out[i]) < 1e-14 && tImagResult[i] < 1e-18 )
+ assert ( 1 ) ;
+ else
+ assert ( fabs( zimags(out[i]) - tImagResult[i] ) / fabs (zimags (out[i])) < 1e-12 ) ;
+
+ }
+
+}
+
static int testFft(void) {
printf("\n>>>> FFT Tests\n");
@@ -278,7 +370,8 @@ static int testFft(void) {
printf("\t>>>> Vector 8 Double Complex Tests\n");
zfftmaTest8();
-
+ printf("\t>>>> Vector 32 Double Complex Tests\n");
+ zfftmaTest32();
return 0;
}