Aller au contenu

Mathc matrices/03v

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       RC1  
/* ------------------------------------ */       
/* ------------------------------------ */
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 **EValue    = eigs_mR(A, i_mR(RCA,RCA));
double **V         =            i_mR(RCA,RCA);

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

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

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

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

         smul_mR(EValue[EVALUE][C1],Ide,sIde); 
        MmnsD_mR(A,sIde,AmnssIde);   
        
          c_A_b_Ab_mR(AmnssIde,b,Ab);
           
       GJ_PP_FreeV_mR(Ab,b_free);
  
          c_c_mR(b_free,C2,V,EVALUE);  

    Normalize_mR(V);
  

printf("     sIde : EVALUE%d * Ide",EVALUE);                    p_mR(sIde, S12,P5, C4);  

//  printf(" AmnssIde : A - (EVALUE%d*Ide)",EVALUE);                p_mR(AmnssIde, S9,P5, C4); 
  
//  printf("       Ab : [A-(EVALUE%d*Ide)] V%d = 0 ",EVALUE,EVALUE); p_mR(Ab, S11,P5, C4);  

//  printf("   b_free :");                                           p_mR(b_free, S9,P5, C4); 
        
//  printf("      V%d :",EVALUE);                                    p_mR(V, S9,P5, C4); 
  stop();
   
  f_mR(EValue);

  f_mR(Ab);
  f_mR(b);
  f_mR(b_free);
  
  f_mR(Ide);
  f_mR(sIde);
  f_mR(AmnssIde);   
}
/* ------------------------------------ */
int main(void)
{
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Étudier les calculs intermédiaires


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 

     sIde : EVALUE1 * Ide
    +5.00000     +0.00000     +0.00000     +0.00000 
    +0.00000     +5.00000     +0.00000     +0.00000 
    +0.00000     +0.00000     +5.00000     +0.00000 
    +0.00000     +0.00000     +0.00000     +5.00000 

 Press return to continue.