Valeurs propres


Installer et compiler ces fichiers 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  
/* ------------------------------------ */ 
/* ------------------------------------ */
double **invEigsValue_mZ(
double **EigsValue,
double **invEigsValue
)
{
int  r;
int  c;
nb_Z a;

  for (   r=R1; r<EigsValue[R_SIZE][C0]; r++)
    for ( c=C1; c<EigsValue[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
          {
             a = inv_Z(i_Z( EigsValue[r][c], EigsValue[r][c+C1]));
           
               invEigsValue[r][c   ] = a.r;
               invEigsValue[r][c+C1] = a.i;
          }
              
 return(invEigsValue);
}
/* ------------------------------------ */     
/* ------------------------------------ */
void fun(void)
{                          
double **A            = i_mZ(RCA,RCA);
double **invA         = 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);
double **invEigsValue = i_mZ(RCA,RCA);

   do
  {
	    r_mZ(A,99);
   eigs_V_mZ(A,V,FACTOR_E);
  }while(!det_Z(V).r);
  
  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 :");
  eigs_V_mZ(A,V,FACTOR_E);
  pE_mZ(V, S12,P4, S12,P4, C3);
  
  printf(" inv(V) ... Some time the matrix is not invertible :");
  inv_mZ(V,invV);
  pE_mZ(invV, S12,P4, S12,P4, C3);
  stop();

  clrscrn();    
  printf(" EigsValue = invV * A * V");
  mul_mZ(invV,A,T);
  mul_mZ(T,V,EigsValue); 
  pE_mZ(clean_eyes_mZ(EigsValue), S12,P4, S12,P4, C3);
  
  printf(" invEigsValue :");
  invEigsValue_mZ(EigsValue, invEigsValue);
  pE_mZ(invEigsValue, S12,P4, S12,P4, C3);  
  stop();

  clrscrn();        
  printf(" invA = V * invEigsValue * invV");
  mul_mZ(V,invEigsValue,T);
  mul_mZ(T,invV,invA); 
  pE_mZ(invA, S12,P4, S12,P4, C3);

  printf(" Ide = A * invA ");
  mul_mZ(A,invA,T); 
  p_mZ(T, S10,P4, S8,P4, C3); 
                 
  f_mZ(A);
  f_mZ(invA);
  f_mZ(V);  
  f_mZ(invV);  
  f_mZ(T);  
  f_mZ(EigsValue);
  f_mZ(invEigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

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


Exemple de sortie écran :
 Copy/Past into the octave windows 


 a=[
-28-80*i,-47+5*i,-57+27*i;
+6-84*i,+27-20*i,+33-9*i;
-16-9*i,-79+68*i,-18+37*i]

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


 V :
 +5.4357e-01 +2.8327e-01i  +1.5818e-01 +2.9866e-01i  -3.0179e-01 +3.9226e-02i 
 -1.4062e-01 +5.4817e-01i  -1.0469e-01 -5.4660e-01i  -5.5593e-01 +3.9378e-01i 
 +5.5139e-01 +0.0000e+00i  +7.5898e-01 +0.0000e+00i  +6.6578e-01 +0.0000e+00i 

 inv(V) ... Some time the matrix is not invertible :
 +1.0991e+00 -1.0846e-01i  -6.5297e-02 -5.4744e-01i  +1.1350e-01 -5.3242e-01i 
 +7.6464e-03 -3.8132e-01i  +2.2589e-01 +7.8333e-01i  +6.3293e-01 +3.4719e-01i 
 -9.1896e-01 +5.2453e-01i  -2.0343e-01 -4.3961e-01i  +6.8647e-01 +4.5148e-02i 

 Press return to continue. 


 EigsValue = invV * A * V
 -7.6605e+01 -7.5973e+01i  +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +4.2075e+01 +7.6343e+01i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +1.5530e+01 -6.3370e+01i 

 invEigsValue :
 -6.5810e-03 +6.5267e-03i  +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +5.5373e-03 -1.0047e-02i  +0.0000e+00 +0.0000e+00i 
 +0.0000e+00 +0.0000e+00i  +0.0000e+00 +0.0000e+00i  +3.6482e-03 +1.4886e-02i 

 Press return to continue. 


 invA = V * invEigsValue * invV
 -1.8970e-03 +4.0743e-03i  +5.3171e-04 +7.5372e-03i  +1.7514e-03 +1.4049e-03i 
 +6.6327e-03 -2.3956e-04i  -3.5301e-03 +1.4054e-03i  -1.0975e-02 -7.5105e-03i 
 -1.3904e-02 -5.1458e-03i  +1.2993e-02 +2.3711e-04i  +8.0315e-03 +5.8864e-03i 

 Ide = A * invA 
   +1.0000 -0.0000i    +0.0000 +0.0000i    +0.0000 +0.0000i 
   +0.0000 -0.0000i    +1.0000 +0.0000i    -0.0000 +0.0000i 
   -0.0000 -0.0000i    +0.0000 -0.0000i    +1.0000 -0.0000i 


 Press   return to continue
 Press X return to stop