Mathc complexes/a280
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
c0a3.c |
---|
/* ------------------------------------ */
/* Save as : c0a3.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#include "f.h"
/* ------------------------------------ */
int main(void)
{
double dft3[R3*(C3*C2)] = { 1,0, 1, 0., 1, 0,
1,0, f(1,3).r,f(1,3).i, f(2,3).r,f(2,3).i,
1,0, f(2,3).r,f(2,3).i, f(4,3).r,f(4,3).i };
double f[R3*(C1*C2)] = { 1,0,
1,0,
2,0 };
double **DFT3 = ca_A_mZ(dft3, i_mZ(R3,C3));
double **cDFT3 = conj_mZ(DFT3, i_mZ(R3,C3));
double **cDFT3div3 = smul_mZ(1./3.,cDFT3,i_mZ(R3,C3));
double **F = ca_A_mZ(f,i_mZ(R3,C1));
double **Ft = i_mZ(R3,C1);
clrscrn();
printf(" DFT3 : ");
p_mZ(DFT3,S4,P3,S3,P3,C6);
printf(" F : ");
p_mZ(F,S4,P3,S3,P3,C6);
printf(" Ft = DFT3 * F ");
mul_mZ(DFT3,F,Ft);
p_mZ(Ft,S4,P3,S3,P3,C6);
stop();
clrscrn();
printf(" F : ");
p_mZ(m0_mZ(F),S4,P3,S3,P3,C6);
printf(" 1/3 cDFT3 : ");
p_mZ(cDFT3div3,S4,P3,S3,P3,C6);
printf(" F = 1/3 cDFT3 * Ft : ");
mul_mZ(cDFT3div3,Ft,F);
p_mZ(F,S4,P3,S3,P3,C6);
stop();
f_mZ(DFT3);
f_mZ(cDFT3);
f_mZ(cDFT3div3);
f_mZ(F);
f_mZ(Ft);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
DFT3 :
+1.000+0.000i +1.000+0.000i +1.000+0.000i
+1.000+0.000i -0.500-0.866i -0.500+0.866i
+1.000+0.000i -0.500+0.866i -0.500-0.866i
F :
+1.000+0.000i
+1.000+0.000i
+2.000+0.000i
Ft = DFT3 * F
+4.000+0.000i
-0.500+0.866i
-0.500-0.867i
Press return to continue.
Exemple de sortie écran :
F :
+0.000+0.000i
+0.000+0.000i
+0.000+0.000i
1/3 cDFT3 :
+0.333-0.000i +0.333-0.000i +0.333-0.000i
+0.333-0.000i -0.167+0.289i -0.167-0.289i
+0.333-0.000i -0.167-0.289i -0.167+0.289i
F = 1/3 cDFT3 * Ft :
+1.000-0.000i
+1.000+0.000i
+2.000+0.000i
Press return to continue.