Aller au contenu

Mathc matrices/03o

Un livre de Wikilivres.


É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] ={   
+1.345288030, +1.760536858, -1.232763852, 
+1.760536858, +4.139646496, +0.479295438, 
-1.232763852, +0.479295438, +3.515065475    
};
                       
double **A      =   ca_A_mR(a, i_mR(RCA,RCA));
double **V      = eigs_V_mR(A, i_mR(RCA,RCA));
double **invV   =  invgj_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,P5, C3);     

  printf(" V :");
  p_mR(V, S9,P5, C4); 
 
  printf(" EValue = invV * A * V");
  mul_mR(invV,A,T);
  mul_mR(T,V,EValue);
//  c_s_mR(0.,EValue,R3,C3);
  pE_mR(clean_eye_mR(EValue), S12,P4, C3); 

          
  printf(" A = V * EValue * invV");
  mul_mR(V,EValue,T);
  mul_mR(T,invV,A); 
  p_mR(A, S8,P5, C3);
  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 :
+1.34529 +1.76054 -1.23276 
+1.76054 +4.13965 +0.47930 
-1.23276 +0.47930 +3.51507 

 V :
 +0.45779  -0.27269  +0.84621 
 +0.88400  +0.24101  -0.40057 
 -0.09471  +0.93143  +0.35139 

 EValue = invV * A * V
 +5.0000e+00  +0.0000e+00  +0.0000e+00 
 +0.0000e+00  +4.0000e+00  +0.0000e+00 
 +0.0000e+00  +0.0000e+00  +0.0000e+00 

 A = V * EValue * invV
+1.34529 +1.76054 -1.23276 
+1.76054 +4.13965 +0.47930 
-1.23276 +0.47930 +3.51507 

 Press return to continue.