É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
/* ------------------------------------ */
#define    EV    R2  
/* ------------------------------------ */
int main(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 **A        = ca_A_mR(a, i_mR(RCA,RCA));
double **EValue   = eigs_mR(A, i_mR(RCA,RCA));

double **Ide      =  eye_mR(   i_mR(RCA,RCA));
double **sIde     =            i_mR(RCA,RCA);
double **AmnssIde =            i_mR(RCA,RCA);

double **Ab       =            i_Abr_Ac_bc_mR(RCA,RCA,C1);
double **b        =            i_mR(RCA,C1);
double **Ab_free  =            i_Abr_Ac_bc_mR(RCA,RCA,RCA);
double **b_free   =            i_mR(RCA,RCA);

double **V        =            i_mR(RCA,RCA);

  clrscrn();
  printf(" A :");
  p_mR(A,S10,P5,C10);
  
         smul_mR(EValue[EV][C1],Ide,sIde);          
        MmnsD_mR(A,sIde,AmnssIde);
        
     c_A_b_Ab_mR(AmnssIde,b,Ab); 
        gj_PP_mR(Ab,NO);  
    put_zeroR_mR(Ab,Ab_free);
    put_freeV_mR(Ab_free); 
        gj_PP_mR(Ab_free,YES);      
       c_Ab_b_mR(Ab_free,b_free);

          c_c_mR(b_free,C2,V,EV); 
          c_c_mR(b_free,C3,V,EV+C1); 
          c_c_mR(b_free,C4,V,EV+C2); 
                    
    Normalize_mR(V);
           
          printf(" V%d : Copy V%d into the last file",EV,EV);
          P_mR(V,S10,P12,C10);  
           
  stop();
             
  f_mR(A);
  f_mR(EValue);
  
  f_mR(Ide);
  f_mR(sIde);
  f_mR(AmnssIde);
  
  f_mR(Ab);
  f_mR(b);
  f_mR(Ab_free);    
  f_mR(b_free);
  
  f_mR(V); 
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Calculer les trois premiers vecteurs propres


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 

 V2 : Copy V2 into the last file
      -nan, -0.816415639507, -0.340441083605, -0.848510478701, 
      -nan, +0.577464720627, +0.000000000000, +0.000000000000, 
      -nan, +0.000000000000, +0.940265849956, +0.000000000000, 
      -nan, +0.000000000000, +0.000000000000, +0.529178578114  

 Press return to continue.