Aller au contenu

Mathc matrices/03t

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] ={   
+3.267287828, -0.475271661, -0.227635307, +0.991405738, 
-0.475271661, +3.181920907, -1.871467453, -1.222576216, 
-0.227635307, -1.871467453, +2.581540251, -0.755834393, 
+0.991405738, -1.222576216, -0.755834393, +1.969251014    
};
                       
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, C4);     

  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,R4,C4);
  pE_mR(clean_eye_mR(EValue), S12,P4, 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;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de référence


Exemple de sortie écran :
 A :
+3.26729 -0.47527 -0.22764 +0.99141 
-0.47527 +3.18192 -1.87147 -1.22258 
-0.22764 -1.87147 +2.58154 -0.75583 
+0.99141 -1.22258 -0.75583 +1.96925 

 V :
 -0.31795  +0.69685  +0.64009  -0.05995 
 +0.76747  +0.13627  +0.28512  +0.55779 
 -0.47145  -0.53535  +0.40238  +0.57378 
 -0.29602  +0.45742  -0.58914  +0.59670 

 EValue = invV * A * V
 +5.0000e+00  +0.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  +2.0000e+00  +0.0000e+00 
 +0.0000e+00  +0.0000e+00  +0.0000e+00  +0.0000e+00 

 A = V * EValue * invV
+3.26729 -0.47527 -0.22764 +0.99141 
-0.47527 +3.18192 -1.87147 -1.22258 
-0.22764 -1.87147 +2.58154 -0.75583 
+0.99141 -1.22258 -0.75583 +1.96925 

 Press return to continue.