Mathc complexes/a281
Installer et compiler ce fichier dans votre répertoire de travail.
c0a4.c |
---|
/* ------------------------------------ */
/* Save as : c0a4.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#include "f.h"
/* ------------------------------------ */
int main(void)
{
double dft4[R4*(C4*C2)] = {
1, 0, 1, 0, 1, 0, 1, 0,
1, 0, f(1,4).r,f(1,4).i, f(2,4).r,f(2,4).i, f(3,4).r,f(3,4).i,
1, 0, f(2,4).r,f(2,4).i, f(4,4).r,f(4,4).i, f(6,4).r,f(6,4).i,
1, 0, f(3,4).r,f(3,4).i, f(6,4).r,f(6,4).i, f(9,4).r,f(9,4).i, };
double f[R4*(C1*C2)] = { 1, 0,
0, 0,
2, 0,
0, 0 };
double **DFT4 = ca_A_mZ(dft4, i_mZ(R4,C4));
double **cDFT4 = conj_mZ(DFT4, i_mZ(R4,C4));
double **cDFT4div4 = smul_mZ(1/4.,cDFT4,i_mZ(R4,C4));
double **F = ca_A_mZ(f, i_mZ(R4,C1));
double **Ft = i_mZ(R4,C1);
clrscrn();
printf(" DFT4 : ");
p_mZ(DFT4,S4,P3,S3,P3,C6);
printf(" F : ");
p_mZ(F,S4,P3,S3,P3,C6);
printf(" Ft = DFT4 * F : ");
mul_mZ(DFT4,F,Ft);
p_mZ(Ft,S4,P3,S3,P3,C6);
stop();
clrscrn();
printf(" F : ");
p_mZ(m0_mZ(F),S4,P0,S3,P0,C6);
printf(" 1/4 cDFT4 : ");
p_mZ(cDFT4div4,S4,P3,S3,P3,C6);
printf(" F = 1/4 cDFT4 * Ft : ");
mul_mZ(cDFT4div4,Ft,F);
p_mZ(F,S4,P3,S3,P3,C6);
stop();
f_mZ(DFT4);
f_mZ(cDFT4);
f_mZ(cDFT4div4);
f_mZ(F);
f_mZ(Ft);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
DFT4 :
+1.000+0.000i +1.000+0.000i +1.000+0.000i +1.000+0.000i
+1.000+0.000i -0.000-1.000i -1.000+0.000i +0.000+1.000i
+1.000+0.000i -1.000+0.000i +1.000-0.000i -1.000+0.000i
+1.000+0.000i +0.000+1.000i -1.000+0.000i -0.000-1.000i
F :
+1.000+0.000i
+0.000+0.000i
+2.000+0.000i
+0.000+0.000i
Ft = DFT4 * F :
+3.000+0.000i
-1.000+0.000i
+3.000-0.000i
-1.000+0.000i
Press return to continue.
Exemple de sortie écran :
F :
+0 +0i
+0 +0i
+0 +0i
+0 +0i
1/4 cDFT4 :
+0.250-0.000i +0.250-0.000i +0.250-0.000i +0.250-0.000i
+0.250-0.000i -0.000+0.250i -0.250-0.000i +0.000-0.250i
+0.250-0.000i -0.250-0.000i +0.250+0.000i -0.250-0.000i
+0.250-0.000i +0.000-0.250i -0.250-0.000i -0.000+0.250i
F = 1/4 cDFT4 * Ft :
+1.000+0.000i
-0.000+0.000i
+2.000-0.000i
-0.000-0.000i
Press return to continue.