Mathc complexes/a85
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mZ( i_mZ(r,r),9);
double **B = r_mZ( i_mZ(r,r),9);
double **AplsB = add_mZ(A,B, i_mZ(r,r));
clrscrn();
printf(" A : ");
p_mZ(A,S5,P0, S5,P0, C6);
printf(" B : ");
p_mZ(B,S5,P0, S5,P0, C6);
printf("\n\n Trace(A)+Trace(B) =");
p_Z(trace_Z(A), S4,P0, S3,P0);
p_Z(trace_Z(B), S4,P0, S3,P0);
printf(" =");
p_Z(add_Z(trace_Z(A),trace_Z(B)), S4,P0, S3,P0);
printf("\n\n Trace(A+B)\t\t\t=");
p_Z(trace_Z(AplsB), S4,P0, S3,P0);
printf("\n\n\n\n");
f_mZ(A);
f_mZ(B);
f_mZ(AplsB);
}
/* ------------------------------------ */
void hello(void)
{
printf("\n ");
printf("\n ");
printf("\n Trace(A+B) = Trace(A) + Trace(B): ");
printf("\n ******************************** ");
printf("\n ");
printf("\n ");
printf("\n \n");
stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
hello();
do{
fun(rp_I(RC4));
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La fonction trace se contente d'additionner tous les coefficients sur la diagonale.
Exemple de sortie écran :
A :
+9 -8i -9 -1i +3 -5i +4 -2i
+4 -7i -2 -4i -4 -4i +8 +7i
-5 +1i -6 -2i +8 +2i +9 -8i
-6 +1i +5 -6i -5 +5i +1 +5i
B :
-2 +8i -1 +1i -4 +7i -2 -9i
+5 -2i +2 -5i +1 -4i -6 -6i
-8 +3i -9 -5i +3 +1i -4 +9i
-7 -5i -4 +2i -6 -2i -8 +6i
Trace(A)+Trace(B) = +16 -5i -5+10i = +11 +5i
Trace(A+B) = +11 +5i
Press return to continue
Press X return to stop