summaryrefslogtreecommitdiff
path: root/src/signalProcessing/fft
diff options
context:
space:
mode:
authorsimon2008-09-25 15:38:28 +0000
committersimon2008-09-25 15:38:28 +0000
commit72c4b0080eaf19b562489ea1a96df77a5a6601e3 (patch)
treecf6fce082f4a9fa1269aaf5bb18c4ddcfd7d45ef /src/signalProcessing/fft
parent64913210fb69211b7ed0fead0a63243561d8ec36 (diff)
downloadscilab2c-72c4b0080eaf19b562489ea1a96df77a5a6601e3.tar.gz
scilab2c-72c4b0080eaf19b562489ea1a96df77a5a6601e3.tar.bz2
scilab2c-72c4b0080eaf19b562489ea1a96df77a5a6601e3.zip
all work now except zfftmaTest4 , but the problem will certainly be less time consuming than the previous ones
Diffstat (limited to 'src/signalProcessing/fft')
-rw-r--r--src/signalProcessing/fft/fft842.c7
-rw-r--r--src/signalProcessing/fft/r2tx.c2
-rw-r--r--src/signalProcessing/fft/r4tx.c2
-rw-r--r--src/signalProcessing/fft/testDoubleFft.c34
4 files changed, 22 insertions, 23 deletions
diff --git a/src/signalProcessing/fft/fft842.c b/src/signalProcessing/fft/fft842.c
index 04c09b19..5aef5752 100644
--- a/src/signalProcessing/fft/fft842.c
+++ b/src/signalProcessing/fft/fft842.c
@@ -80,14 +80,13 @@ void fft842 (doubleComplex* b, int size , int in)
lengt = 8*nxtlt;
printf ( "on appelle r%dtx \n" , 8);
- for (i= 0 ; i < size ; i++)
- printf ( "%d - avant r8 %e %e %d\n" , i, zreals ( b[i]), zimags(b[i]), nxtlt);
-
r8tx(nxtlt,nthpo,lengt,
b,b+nxtlt,b+2*nxtlt,
b+3*nxtlt,b+4*nxtlt,b+5*nxtlt,
b+6*nxtlt,b+7*nxtlt);
+
+
}
}
@@ -96,6 +95,8 @@ void fft842 (doubleComplex* b, int size , int in)
/* radix 2 iteration needed */
printf ( "on appelle r%dtx \n" , 2);
r2tx(nthpo,b,b+1);
+
+
}
diff --git a/src/signalProcessing/fft/r2tx.c b/src/signalProcessing/fft/r2tx.c
index c1231dc9..8c945061 100644
--- a/src/signalProcessing/fft/r2tx.c
+++ b/src/signalProcessing/fft/r2tx.c
@@ -28,7 +28,7 @@ void r2tx(int nthpo, doubleComplex* c0, doubleComplex* c1)
for(k=0;k<nthpo;k+=2)
{
- kk = k*2;
+ kk = k;
temp = zadds ( c0[kk] , c1[kk] );
c1[kk] = zdiffs( c0[kk] , c1[kk] );
diff --git a/src/signalProcessing/fft/r4tx.c b/src/signalProcessing/fft/r4tx.c
index c75b5d4e..10bbfe02 100644
--- a/src/signalProcessing/fft/r4tx.c
+++ b/src/signalProcessing/fft/r4tx.c
@@ -24,7 +24,7 @@ void r4tx( int nthpo, doubleComplex* c0, doubleComplex* c1, doubleComplex* c2, d
for(k=1;k<=nthpo;k+=4)
{
- kk = (k-1)*2; /* real and imag parts alternate */
+ kk = k; /* real and imag parts alternate */
temp1 = zadds ( c0[kk] , c2[kk] ) ;
diff --git a/src/signalProcessing/fft/testDoubleFft.c b/src/signalProcessing/fft/testDoubleFft.c
index 2fa2bac1..04f18673 100644
--- a/src/signalProcessing/fft/testDoubleFft.c
+++ b/src/signalProcessing/fft/testDoubleFft.c
@@ -224,42 +224,39 @@ static void zfftmaTest16 (void )
doubleComplex* out = (doubleComplex*) malloc ( sizeof(doubleComplex) * (unsigned int) (ROW*COLS16));
doubleComplex* in = DoubleComplexMatrix ( tRealIn , tImagIn , ROW*COLS16 );
- doubleComplex* Result = DoubleComplexMatrix ( tRealResult , tImagResult ,ROW*COLS16) ;
-for ( i = 0 ; i < (ROW*COLS16 ) ; i++ )
- printf ("%ddebutdebut resultat\t %e\t %e \n",i , zreals(Result[i]) ,zimags(Result[i]));
- printf ("\n\n\n\n");
- zfftma ( in , ROW , COLS16 , out ) ;
- i = 0;
-for ( i = 0 ; i < (ROW*COLS16 ) ; i++ )
- printf ("%ddebutdebut resultat\t %e\t %e \n",i , zreals(Result[i]) ,zimags(Result[i]));
- printf ("\n\n\n\n");
+ zfftma ( in , ROW , COLS16 , 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*COLS16 ) ; i++ )
{
- printf ("%ddebutdebut resultat\t %e\t %e \n",i , zreals(Result[i]) ,zimags(Result[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]),
- zreals (Result[i]) ,
- zimags (Result[i]),
- fabs( zreals(out[i]) - zreals (Result[i]) ) / fabs (zreals (out[i])) ,
- fabs( zimags(out[i]) - zimags (Result[i]) ) / fabs (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 && zreals (Result[i]) < 1e-18 )
+
+ if ( zreals(out[i]) < 1e-14 && tRealResult[i] < 1e-18 )
assert ( 1 ) ;
else
- assert ( fabs( zreals(out[i]) - zreals (Result[i]) ) / fabs (zreals (out[i])) < 1e-12 );
+ assert ( fabs( zreals(out[i]) - tRealResult[i] ) / fabs (zreals (out[i])) < 1e-12 );
- if ( zimags(out[i]) < 1e-14 && zimags (Result[i]) < 1e-18 )
+ if ( zimags(out[i]) < 1e-14 && tImagResult[i] < 1e-18 )
assert ( 1 ) ;
else
- assert ( fabs( zimags(out[i]) - zimags (Result[i]) ) / fabs (zimags (out[i])) < 1e-12 ) ;
+ assert ( fabs( zimags(out[i]) - tImagResult[i] ) / fabs (zimags (out[i])) < 1e-12 ) ;
}
@@ -273,6 +270,7 @@ static int testFft(void) {
printf("\t>>>> Vector 16 Double Complex Tests\n");
zfftmaTest16();
printf("\n\n\n");
+
printf("\t>>>> Vector 2 Double Complex Tests\n");
zfftmaTest2();
printf("\t>>>> Vector 4 Double Complex Tests\n");