Aller au contenu

Mathc matrices/c33 1a

Un livre de Wikilivres.


Application


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

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

  r_commute2_mR(A,B,9);

  clrscrn();
  printf(" A : ");
  p_mR(A,S5,P3,C6);                                
  printf(" B : ");
  p_mR(B,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);
    
  f_mR(A);
  f_mR(B);
  f_mR(T);
  f_mR(AB);
  f_mR(BA);
}
/* ------------------------------------ */
void hello(void)
{
  
  printf("\n                                                  ");
  printf("\n       Two 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;
}
/*------------------------------------ */
/* ------------------------------------ */


  Tester la bibliothèque.


Exemple de sortie écran :

 A : 
+0.214 +1.574 +1.903 
-0.096 +1.652 +1.078 
-0.093 -1.446 -1.725 

 B : 
-1.257 +0.164 -1.039 
-0.247 -0.109 -0.231 
+0.247 -0.036 +0.085 

 Press return to continue. 

 

 AB : 
-0.188074279 -0.205877798 -0.423527180 
-0.020851677 -0.235269711 -0.189394508 
+0.048468302 +0.205236632 +0.283636241 

 BA : 
-0.188074279 -0.205877798 -0.423527180 
-0.020851677 -0.235269711 -0.189394508 
+0.048468302 +0.205236632 +0.283636241 


 Press return to continue
 Press X      to stop