Aller au contenu

Mathc matrices/04a

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]={
+9.387051138013, +1.478424899325, +0.973685336456, -0.700350180421, 
+1.478424899325, +9.614194406175, +0.773429774749, -1.033063523876, 
+0.973685336456, +0.773429774749, +10.505111304292, +1.482769644746, 
-0.700350180421, -1.033063523876, +1.482769644746, +10.493643151520    
};

double v[RCA*RCA]={
+0.545516920109, -0.502145306797, -0.756196931416, -0.703339481002, 
+0.544568195031, -0.586388346015, +0.647558469922, +0.704564811108, 
+0.637068890180, +0.000000000000, +0.093990579046, +0.000000000000, 
+0.000000000000, +0.635608998142, +0.000000000000, +0.094350418183    
};
                        
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 :
+9.38705 +1.47842 +0.97369 -0.70035 
+1.47842 +9.61419 +0.77343 -1.03306 
+0.97369 +0.77343 +10.50511 +1.48277 
-0.70035 -1.03306 +1.48277 +10.49364 

 V :
 +0.54552  -0.50215  -0.75620  -0.70334 
 +0.54457  -0.58639  +0.64756  +0.70456 
 +0.63707  +0.00000  +0.09399  +0.00000 
 +0.00000  +0.63561  +0.00000  +0.09435 

 EValue = invV * A * V
+12.00000  +0.00000  +0.00000  +0.00000 
 +0.00000 +12.00000  +0.00000  +0.00000 
 +0.00000  +0.00000  +8.00000  +0.00000 
 +0.00000  +0.00000  +0.00000  +8.00000 

 A = V * EValue * invV
+9.38705 +1.47842 +0.97369 -0.70035 
+1.47842 +9.61419 +0.77343 -1.03306 
+0.97369 +0.77343 +10.50511 +1.48277 
-0.70035 -1.03306 +1.48277 +10.49364 

 Press return to continue.