Aller au contenu

Mathc matrices/03w

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  
#define EVALUE       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 **V4     =    c_c_mR(V,EVALUE, i_mR(RCA, C1),C1);
double **AV4    =    mul_mR(A,V4, i_mR(RCA, C1)); 

  clrscrn(); 
  printf(" A :");
  p_mR(A, S8,P5, C4);     

  printf(" V :");
  p_mR(V, S9,P5, C4); 
  
  printf(" V%d :",EVALUE);
  p_mR(V4, S8,P5, C4);

  printf(" A * V%d :",EVALUE);
  p_mR(AV4, S8,P5, C4);
  stop();
              
  f_mR(A);
  f_mR(V);  

  f_mR(V4); 
  f_mR(AV4); 
}
/* ------------------------------------ */
int main(void)
{
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Vérifier A v_λ = 0 quand λ = 0 (Rappel  : A v_λ = λ v_λ)


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 

 V4 :
-0.05995 
+0.55779 
+0.57378 
+0.59670 

 A * V4 :
+0.00000 
-0.00000 
-0.00000 
-0.00000 

 Press return to continue.