Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E    +1.E-2         
#define RCA          RC3  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double **A         = i_mZ(RCA,RCA);

double **V         = i_mZ(RCA,RCA);
double **invV      = i_mZ(RCA,RCA);
double **T         = i_mZ(RCA,RCA);

double **EigsValue = i_mZ(RCA,RCA);

   do
  {
    rdiag_mZ(A,99);
   eigs_V_mZ(A,V,FACTOR_E);
  }while((det_Z(V).r && det_Z(V).i));

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n\n");
  p_Octave_mZ(A,"a",P0,P0);  
  printf(" [V, E]  = eigs (a,%d) \n\n\n",RCA);

  printf(" V :");
  pE_mZ(V, S12,P4, S12,P4, C3);
  
  printf(" inv(V) ... Some time the matrix is not invertible :");
  pE_mZ(invgj_mZ(V,invV), S12,P4, S12,P4, C3);
  stop();

  clrscrn(); 
  printf(" A :");
  p_mZ(A, S12,P4, S12,P4, C3);     
 
  printf(" EigsValue = invV * A * V");
  mul_mZ(invV,A,T);
  mul_mZ(T,V,EigsValue);
  pE_mZ(clean_eyes_mZ(EigsValue), S12,P4, S8,P4, C3); 
         
  printf(" A = V * EigsValue * invV");
  mul_mZ(V,EigsValue,T);
  mul_mZ(T,invV,A); 
  p_mZ(A, S12,P4, S12,P4, C3);
            
  f_mZ(A);
  f_mZ(V);  
  f_mZ(invV);  
  f_mZ(T);  
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Valeurs propres vecteurs propres d'une matrice diagonale.


Remarque :

  • Je n'ai pas les même vecteurs propres que octave.
  • Mais je parviens cependant à calculer les valeurs propres (EigsValue = invV * A * V), et a retrouver la matrice A (A = V * EigsValue * invV).


Exemple de sortie écran :

 Copy/Past into the octave windows 


 a=[
+4-54*i,+0+0*i,+0+0*i;
+0+0*i,-95+92*i,+0+0*i;
+0+0*i,+0+0*i,+51+14*i]

 [V, E]  = eigs (a,3) 


 V :
 +1.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +1.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +1.0000e+00 +0.0000e+00i 

 inv(V) ... Some time the matrix is not invertible :
 +1.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +1.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +1.0000e+00 +0.0000e+00i 

 Press return to continue. 


 A :
     +4.0000    -54.0000i      +0.0000     +0.0000i      +0.0000     +0.0000i 
     +0.0000     +0.0000i     -95.0000    +92.0000i      +0.0000     +0.0000i 
     +0.0000     +0.0000i      +0.0000     +0.0000i     +51.0000    +14.0000i 

 EigsValue = invV * A * V
 +4.0000e+00-5.4000e+01i  +0.0000e+00+0.0000e+00i  +0.0000e+00+0.0000e+00i 
 +0.0000e+00+0.0000e+00i  -9.5000e+01+9.2000e+01i  +0.0000e+00+0.0000e+00i 
 +0.0000e+00+0.0000e+00i  +0.0000e+00+0.0000e+00i  +5.1000e+01+1.4000e+01i 

 A = V * EigsValue * invV
     +4.0000    -54.0000i      +0.0000     +0.0000i      +0.0000     +0.0000i 
     +0.0000     +0.0000i     -95.0000    +92.0000i      +0.0000     +0.0000i 
     +0.0000     +0.0000i      +0.0000     +0.0000i     +51.0000    +14.0000i 


 Press   return to continue
 Press X return to stop