Étude du code


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */     
#define RCA          RC4  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*RCA] ={   
 -84,  -39,  +22,  -55, 
 -39,  +27,  -33,   +6, 
 +22,  -33,  +45,  +44, 
 -55,   +6,  +44,  +54  
};
                       
double **A      =   ca_A_mR(a, i_mR(RCA,RCA));
double **V      = eigs_V_mR(A, i_mR(RCA,RCA));
double **invV   =    inv_mR(V, i_mR(RCA,RCA));
double **EValue =   eigs_mR(A, i_mR(RCA, RCA));

double **T      =              i_mR(RCA,RCA);

  clrscrn(); 
  printf(" A :");
  p_mR(A, S8,P0, C4);     

  printf(" V :");
  p_mR(V, S9,P5, C4); 
 
  printf(" EValue = invV * A * V");
  mul_mR(invV,A,T);
  mul_mR(T,V,EValue);
  pE_mR(clean_eye_mR(EValue), S12,P4, C4); 
         
  printf(" A = V * EValue * invV");
  mul_mR(V,EValue,T);
  mul_mR(T,invV,A); 
  p_mR(A, S8,P0, C4);
  stop();
              
  f_mR(A);
  f_mR(V);  
  f_mR(invV);  
  f_mR(T);  
  f_mR(EValue);
}
/* ------------------------------------ */
int main(void)
{
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de référence


Exemple de sortie écran :
 A :
     -84      -39      +22      -55 
     -39      +27      -33       +6 
     +22      -33      +45      +44 
     -55       +6      +44      +54 

 V :
 +0.90727  -0.10019  -0.39246  +0.11317 
 +0.19259  -0.18339  +0.68702  +0.67622 
 -0.17429  +0.65459  -0.39020  +0.62360 
 +0.33076  +0.72652  +0.47087  -0.37555 

 EValue = invV * A * V
 -1.1656e+02  +0.0000e+00  +0.0000e+00  +0.0000e+00 
 +0.0000e+00  +9.9713e+01  +0.0000e+00  +0.0000e+00 
 +0.0000e+00  +0.0000e+00  +7.2134e+01  +0.0000e+00 
 +0.0000e+00  +0.0000e+00  +0.0000e+00  -1.3291e+01 

 A = V * EValue * invV
     -84      -39      +22      -55 
     -39      +27      -33       +6 
     +22      -33      +45      +44 
     -55       +6      +44      +54 

 Press return to continue.