Aller au contenu

Mathc matrices/04k

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.825339522090, +7.309094034726, -3.954100051573, -1.198212136840, 
+7.309094034726, +5.437252879491, -2.941464672512, -0.891352931064, 
-3.954100051573, -2.941464672512, +1.591284167096, +0.482207323363, 
-1.198212136840, -0.891352931064, +0.482207323363, +0.146123431322     
};

double v[RCA*RCA]={
-0.760237560476, -0.596864313004, +0.373340433764, +0.121054375311, 
-0.565542575476, +0.802342191251, +0.000000000000, +0.000000000000, 
+0.305949262143, +0.000000000000, +0.927694411171, +0.000000000000, 
+0.092711897619, +0.000000000000, +0.000000000000, +0.992645877551     
};
                        
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.82534 +7.30909 -3.95410 -1.19821 
+7.30909 +5.43725 -2.94146 -0.89135 
-3.95410 -2.94146 +1.59128 +0.48221 
-1.19821 -0.89135 +0.48221 +0.14612 

 V :
 -0.76024  -0.59686  +0.37334  +0.12105 
 -0.56554  +0.80234  +0.00000  +0.00000 
 +0.30595  +0.00000  +0.92769  +0.00000 
 +0.09271  +0.00000  +0.00000  +0.99265 

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

 A = V * EValue * invV
+9.82534 +7.30909 -3.95410 -1.19821 
+7.30909 +5.43725 -2.94146 -0.89135 
-3.95410 -2.94146 +1.59128 +0.48221 
-1.19821 -0.89135 +0.48221 +0.14612 

 Press return to continue.