Aller au contenu

Mathc matrices/04g

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]={
+0.447406866326, -0.357925493061, -0.345142439737, 
-0.357925493061, +0.286340394449, +0.276113951790, 
-0.345142439737, +0.276113951790, +0.266252739226       
};

double v[RCA*RCA]={
-0.668884793015, +0.624695047555, +0.610803454292, 
+0.535107834411, +0.780868809443, +0.000000000000, 
+0.515996840326, +0.000000000000, +0.791782255564      
};
                        
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 :
+0.44741 -0.35793 -0.34514 
-0.35793 +0.28634 +0.27611 
-0.34514 +0.27611 +0.26625 

 V :
 -0.66888  +0.62470  +0.61080 
 +0.53511  +0.78087  +0.00000 
 +0.51600  +0.00000  +0.79178 

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

 A = V * EValue * invV
+0.44741 -0.35793 -0.34514 
-0.35793 +0.28634 +0.27611 
-0.34514 +0.27611 +0.26625 

 Press return to continue.