É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          RC3  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*RCA]={
+2/3., -1/3., -2/3., 
-1/3., +2/3., -2/3., 
-2/3., -2/3., -1/3.      
};

double v[RCA*RCA]={
-0.707106781187, -0.894427191000, +0.408248290464,
+0.707106781187, +0.000000000000, +0.408248290464,
+0.000000000000, +0.447213595500, +0.816496580928
};
                        
double **A      =  ca_A_mR(a, i_mR(RCA,RCA));
double **V      =  ca_A_mR(v, i_mR(RCA,RCA));
double **invV   = invgj_mR(V, i_mR(RCA,RCA));
double **EValue =             i_mR(RCA,RCA);

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

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

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


Vérifier les calculs


Exemple de sortie écran :
 A :
+0.66667 -0.33333 -0.66667 
-0.33333 +0.66667 -0.66667 
-0.66667 -0.66667 -0.33333 

 V :
 -0.70711  -0.89443  +0.40825 
 +0.70711  +0.00000  +0.40825 
 +0.00000  +0.44721  +0.81650 

 EValue = invV * A * V
 +1.00000  +0.00000  +0.00000 
 +0.00000  +1.00000  +0.00000 
 +0.00000  +0.00000  -1.00000 

 A = V * EValue * invV
+0.66667 -0.33333 -0.66667 
-0.33333 +0.66667 -0.66667 
-0.66667 -0.66667 -0.33333 

 Press return to continue.