Application

Installer et compiler ce fichier dans votre répertoire de travail.

c01c.c
/* ------------------------------------ */
/*  Save as :   c01c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void AplsB(int r)
{
double **A  = i_mR(r,r);
double **B  = i_mR(r,r);
double **C  = i_mR(r,r);
double **D  = i_mR(r,r);
double **T  = i_mR(r,r);
double **AB = i_mR(r,r);
double **BA = i_mR(r,r);

  r_commute4_mR(A,B,C,D,9);

  clrscrn();
  printf(" A : ");
  p_mR(A,S5,P3,C6);                                
  printf(" B : ");
  p_mR(B,S5,P3,C6);
  printf(" C : ");
  p_mR(C,S5,P3,C6); 
  printf(" D : ");
  p_mR(D,S5,P3,C6);        
  stop();

  clrscrn();
  printf(" AB : ");
  p_mR(mul_mR(A,B,AB),S5,P9,C6);
  printf(" BA : ");
  p_mR(mul_mR(B,A,BA),S5,P9,C6);
  stop();

  clrscrn();
  printf(" AC : ");
  p_mR(mul_mR(A,C,AB),S5,P9,C6);
  printf(" CA : ");
  p_mR(mul_mR(C,A,BA),S5,P9,C6);
  stop();

  clrscrn();
  printf(" BC : ");
  p_mR(mul_mR(B,C,AB),S5,P9,C6);
  printf(" CB : ");
  p_mR(mul_mR(C,B,BA),S5,P9,C6);   
  stop();

  clrscrn();
  printf(" AD : ");
  p_mR(mul_mR(A,D,AB),S5,P9,C6);
  printf(" DA : ");
  p_mR(mul_mR(D,A,BA),S5,P9,C6);
  stop();

  clrscrn();
  printf(" BD : ");
  p_mR(mul_mR(B,D,AB),S5,P9,C6);
  printf(" DB : ");
  p_mR(mul_mR(D,B,BA),S5,P9,C6); 
  stop();

  clrscrn();
  printf(" CD : ");
  p_mR(mul_mR(C,D,AB),S5,P9,C6);
  printf(" DC : ");
  p_mR(mul_mR(D,C,BA),S5,P9,C6); 
  
  f_mR(A);
  f_mR(B);
  f_mR(C);
  f_mR(D);
  f_mR(T);
  f_mR(AB);
  f_mR(BA);
}
/* ------------------------------------ */
void hello(void)
{
  
  printf("\n                                                  ");
  printf("\n     Four Commutative matrices                    ");
  printf("\n            ****************                    \n");
  printf("\n                                                  ");
  printf("\n                                                  ");
  printf("\n                                                \n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  hello();
do
{
  AplsB(RC3);

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran :

 A : 
+0.166 -0.675 +0.311 
-0.768 -0.313 -0.140 
+0.451 -0.144 +0.405 

 B : 
+0.154 +0.327 +0.363 
+0.352 +0.234 -0.387 
+0.481 -0.500 -0.554 

 C : 
-2.964 -3.961 -0.000 
-4.434 -5.228 +0.796 
+0.161 +1.179 +0.546 

 D : 
+2.578 +2.716 -0.503 
+3.061 +4.280 -0.100 
-0.795 -0.250 +0.751 

 Press return to continue. 
 
 
 
 AB : 
-0.062339004 -0.258872567 +0.149440583 
-0.295901450 -0.254772246 -0.080371979 
+0.213947104 -0.088617352 -0.005234657 

 BA : 
-0.062339004 -0.258872567 +0.149440583 
-0.295901450 -0.254772246 -0.080371979 
+0.213947104 -0.088617352 -0.005234657 

 Press return to continue. 
 
 
 AC : 
+2.552146353 +3.238937890 -0.367848775 
+3.640966506 +4.513108698 -0.325010660 
-0.632761552 -0.555686939 +0.106612824 

 CA : 
+2.552146353 +3.238937890 -0.367848775 
+3.640966506 +4.513108698 -0.325010660 
-0.632761552 -0.555686939 +0.106612824 

 Press return to continue. 

 

 BC : 
-1.851440740 -1.895923694 +0.458981779 
-2.141191966 -3.071767768 -0.025622332 
+0.702008327 +0.055244725 -0.700775560 

 CB : 
-1.851440740 -1.895923694 +0.458981779 
-2.141191966 -3.071767768 -0.025622332 
+0.702008327 +0.055244725 -0.700775560 

 Press return to continue. 
 

 AD : 
-1.886277766 -2.516668484 +0.217875173 
-2.826274812 -3.389745271 +0.312729795 
+0.399186093 +0.507068843 +0.092223690 

 DA : 
-1.886277766 -2.516668484 +0.217875173 
-2.826274812 -3.389745271 +0.312729795 
+0.399186093 +0.507068843 +0.092223690 

 Press return to continue. 
 
 BD : 
+1.111771847 +1.730090428 +0.162231310 
+1.930202575 +2.052534715 -0.491409408 
+0.150221221 -0.694361059 -0.607969126 

 DB : 
+1.111771847 +1.730090428 +0.162231310 
+1.930202575 +2.052534715 -0.491409408 
+0.150221221 -0.694361059 -0.607969126 

 Press return to continue. 

 
 CD : 
-19.763973297 -25.001913517 +1.887303670 
-28.066399361 -34.617771858 +3.352390871 
+3.588481645 +5.344669131 +0.210979191 

 DC : 
-19.763973297 -25.001913517 +1.887303670 
-28.066399361 -34.617771858 +3.352390871 
+3.588481645 +5.344669131 +0.210979191 


 Press return to continue
 Press X      to stop