Aller au contenu

Mathc matrices/01t

Un livre de Wikilivres.


Application


Installer et compiler ces fichiers dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A      =         r_mR(    i_mR(rc,rc),9);
double **invA   =       inv_mR(A,  i_mR(rc,rc));
double **A_T    = transpose_mR(A,  i_mR(rc,rc));
double **invA_T =       inv_mR(A_T,i_mR(rc,rc));
double **IDE    =                  i_mR(rc,rc);

  clrscrn();
  printf(" A : ");
  p_mR(A,S4,P0,C6);
  printf(" invA : ");
  p_mR(invA,S9,P5,C6);
  printf(" A * invA : ");
  p_mR(mul_mR(A,invA,IDE),S9,P5,C6);
  stop();

  clrscrn();
  printf(" A_T : ");
  p_mR(A,S4,P0,C6);
  printf(" invA_T : ");
  p_mR(invA_T,S9,P5,C6);
  printf(" A_T * invA_T : ");
  p_mR(mul_mR(A_T,invA_T,IDE),S9,P5,C6); 
  stop();

  clrscrn();
  printf(" invA : ");
  p_mR(invA,S9,P5,C6);
  printf(" invA_T : ");
  p_mR(invA_T,S9,P5,C6);
      
  f_mR(A);
  f_mR(invA);
  f_mR(A_T);
  f_mR(invA_T);
  f_mR(IDE);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC4)+RC1);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran :

 A : 
  -3   +3   -7   -8 
  +5   +6   +2   +4 
  -7   -5   -7   +7 
  +3   +9   +5   +3 

 invA : 
 -0.00612  +0.22256  -0.05772  -0.17840 
 +0.05509  -0.00306  +0.01946  +0.10560 
 -0.07215  -0.16266  -0.03739  +0.11172 
 -0.03892  +0.05772  +0.06165  +0.00875 

 A * invA : 
 +1.00000  +0.00000  +0.00000  -0.00000 
 +0.00000  +1.00000  +0.00000  -0.00000 
 +0.00000  +0.00000  +1.00000  +0.00000 
 +0.00000  -0.00000  -0.00000  +1.00000 

 Press return to continue. 


 A_T : 
  -3   +3   -7   -8 
  +5   +6   +2   +4 
  -7   -5   -7   +7 
  +3   +9   +5   +3 

 invA_T : 
 -0.00612  +0.05509  -0.07215  -0.03892 
 +0.22256  -0.00306  -0.16266  +0.05772 
 -0.05772  +0.01946  -0.03739  +0.06165 
 -0.17840  +0.10560  +0.11172  +0.00875 

 A_T * invA_T : 
 +1.00000  +0.00000  +0.00000  -0.00000 
 -0.00000  +1.00000  +0.00000  -0.00000 
 -0.00000  +0.00000  +1.00000  -0.00000 
 -0.00000  +0.00000  +0.00000  +1.00000 

 Press return to continue. 


 invA : 
 -0.00612  +0.22256  -0.05772  -0.17840 
 +0.05509  -0.00306  +0.01946  +0.10560 
 -0.07215  -0.16266  -0.03739  +0.11172 
 -0.03892  +0.05772  +0.06165  +0.00875 

 invA_T : 
 -0.00612  +0.05509  -0.07215  -0.03892 
 +0.22256  -0.00306  -0.16266  +0.05772 
 -0.05772  +0.01946  -0.03739  +0.06165 
 -0.17840  +0.10560  +0.11172  +0.00875 


 Press   return to continue
 Press X return to stop