Aller au contenu

Mathc matrices/046

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          RC4  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*RCA]={
+5.701637292731, +0.991969965586, +0.254041088748, +1.125039107310, 
+0.991969965586, +6.402440296173, +0.359161539264, +1.590572531025, 
+0.254041088748, +0.359161539264, +5.091980394202, +0.407341745750, 
+1.125039107310, +1.590572531025, +0.407341745750, +6.803942016894    
};

double v[RCA*RCA]={
+0.418818962301, -0.816415639507, -0.340441083605, -0.848510478701, 
+0.592123360495, +0.577464720627, +0.000000000000, +0.000000000000, 
+0.151641348419, +0.000000000000, +0.940265849956, +0.000000000000, 
+0.671554543000, +0.000000000000, +0.000000000000, +0.529178578114    
};
                        
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 =  eigs_mR(A, 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 :
+5.70164 +0.99197 +0.25404 +1.12504 
+0.99197 +6.40244 +0.35916 +1.59057 
+0.25404 +0.35916 +5.09198 +0.40734 
+1.12504 +1.59057 +0.40734 +6.80394 

 V :
 +0.41882  -0.81642  -0.34044  -0.84851 
 +0.59212  +0.57746  +0.00000  +0.00000 
 +0.15164  +0.00000  +0.94027  +0.00000 
 +0.67155  +0.00000  +0.00000  +0.52918 

 EValue = invV * A * V
 +9.00000  +0.00000  +0.00000  +0.00000 
 +0.00000  +5.00000  +0.00000  +0.00000 
 +0.00000  +0.00000  +5.00000  +0.00000 
 +0.00000  +0.00000  +0.00000  +5.00000 

 A = V * EValue * invV
+5.70164 +0.99197 +0.25404 +1.12504 
+0.99197 +6.40244 +0.35916 +1.59057 
+0.25404 +0.35916 +5.09198 +0.40734 
+1.12504 +1.59057 +0.40734 +6.80394 

 Press return to continue.