Aller au contenu

Mathc matrices/c29a3

Un livre de Wikilivres.


La décomposition spectral

Installer et compiler ces fichiers dans votre répertoire de travail.

c00d.c
/* ------------------------------------ */
/*  Save as:  c00d.c                    */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define ARRAY   A3
/* ------------------------------------ */
#define RC     RC3
/* ------------------------------------ */
void fun(void)
{
double **A         = rsymmetric_mR(        i_mR(RC,RC),999);
double **AEVect    =     eigs_V_mR(A,      i_mR(RC,RC));
double **InvAEVect =  transpose_mR(AEVect, i_mR(RC,RC));

double **T         =                       i_mR(RC,RC);

double **b [ARRAY];
double **r [ARRAY];
double **br[ARRAY];


int i;

  for(i=A0; i<ARRAY; i++)
     {
      b[i]  = c_c_mR(   AEVect,i+C1, i_mR(RC,C1),C1);
      r[i]  = c_r_mR(InvAEVect,i+R1, i_mR(R1,RC),R1);
      
      br[i] = mul_mR(b[i],r[i],      i_mR(RC,RC)); 
      }
      
  clrscrn();
  printf(" A:");
  p_mR(A, S10,P4,C6);

  printf(" AEVect:        Eingvectors of A");
  p_mR(AEVect, S10,P4,C6);

  transpose_mR(AEVect,InvAEVect);
  printf(" Inverse of AEVect = InvAEVect");
  p_mR(InvAEVect, S10,P4,C6);
  stop();

  clrscrn(); 
  printf(" The bnrn are projectors.         \n"
         " Several consecutive projections\n\n"
         "                  bnrn**p       \n\n"
         " give the same result         \n\n\n"
         " b1r1:");
  p_mR(br[0], S10,P4,C6);
  
  pow_mR(2, br[0], T);  
  printf(" b1r1**2 = b1r1");
  p_mR(T, S10,P4,C6);
   
  pow_mR(6, br[0], T);  
  printf(" b1r1**6 = b1r1");
  p_mR(T, S10,P4,C6);
  stop();
  

  clrscrn();
  printf(" The bnrn are projectors.         \n"
         " Several consecutive projections\n\n"
         "                  bnrn**p       \n\n"
         " give the same result         \n\n\n"
         " b2r2:");
  p_mR(br[1], S10,P4,C6);
  
  pow_mR(2, br[1], T);  
  printf(" b2r2**2 = b2r2");
  p_mR(T, S10,P4,C6);
   
  pow_mR(6, br[1], T);  
  printf(" b2r2**6 = b2r2");
  p_mR(T, S10,P4,C6);
  stop();
  
  clrscrn();
  printf(" The bnrn are projectors.         \n"
         " Several consecutive projections\n\n"
         "                  bnrn**p       \n\n"
         " give the same result         \n\n\n"
         " b3r3:");
  p_mR(br[2], S10,P4,C6);
  
  pow_mR(2, br[2], T);  
  printf(" b3r3**2 = b3r3");
  p_mR(T, S10,P4,C6);
   
  pow_mR(6, br[2], T);  
  printf(" b3r3**6 = b3r3");
  p_mR(T, S10,P4,C6);
  
  f_mR(A);
  f_mR(AEVect);
  f_mR(InvAEVect);    

  f_mR(T);

  for(i=A0; i<ARRAY; i++)
     {
       f_mR (b[i]);
       f_mR( r[i]);
       f_mR(br[i]);               
     } 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous voyons une des propriètés de la décomposition spectral:

* b1r1**2 = b1r1
* b1r1**4 = b1r1
* b1r1**6 = b1r1
  
Les b*r* sont des projecteurs. Si par exemple je projette le point P sur l'axe des x. P est sur l'axe des x. Une fois que P est sur l'axe de x, je peut le projeter une infinité de fois sur l'axe des x il ne bougera plus. Cela ce matérialise dans  notre cas par le faite b1r1**2 = b1r1, b1r1**3 = b1r1, ... b1r1**n = b1r1
Exemple de sortie écran :
 A:
 -871.0000  -392.0000  -378.0000 
 -392.0000  -457.0000  +455.0000 
 -378.0000  +455.0000  +377.0000 

 AEVect:        Eingvectors of A
   +0.8795    -0.3038    -0.3664 
   +0.4692    +0.4244    +0.7744 
   +0.0798    +0.8530    -0.5158 

 Inverse of AEVect = InvAEVect
   +0.8795    +0.4692    +0.0798 
   -0.3038    +0.4244    +0.8530 
   -0.3664    +0.7744    -0.5158 

 Press return to continue. 


 The bnrn are projectors.         
 Several consecutive projections

                  bnrn**p       

 give the same result         


 b1r1:
   +0.7735    +0.4127    +0.0701 
   +0.4127    +0.2202    +0.0374 
   +0.0701    +0.0374    +0.0064 

 b1r1**2 = b1r1
   +0.7735    +0.4127    +0.0701 
   +0.4127    +0.2202    +0.0374 
   +0.0701    +0.0374    +0.0064 

 b1r1**6 = b1r1
   +0.7735    +0.4127    +0.0701 
   +0.4127    +0.2202    +0.0374 
   +0.0701    +0.0374    +0.0064 

 Press return to continue. 


 The bnrn are projectors.         
 Several consecutive projections

                  bnrn**p       

 give the same result         


 b2r2:
   +0.0923    -0.1289    -0.2591 
   -0.1289    +0.1801    +0.3620 
   -0.2591    +0.3620    +0.7276 

 b2r2**2 = b2r2
   +0.0923    -0.1289    -0.2591 
   -0.1289    +0.1801    +0.3620 
   -0.2591    +0.3620    +0.7276 

 b2r2**6 = b2r2
   +0.0923    -0.1289    -0.2591 
   -0.1289    +0.1801    +0.3620 
   -0.2591    +0.3620    +0.7276 

 Press return to continue. 


 The bnrn are projectors.         
 Several consecutive projections

                  bnrn**p       

 give the same result         


 b3r3:
   +0.1342    -0.2837    +0.1890 
   -0.2837    +0.5997    -0.3994 
   +0.1890    -0.3994    +0.2661 

 b3r3**2 = b3r3
   +0.1342    -0.2837    +0.1890 
   -0.2837    +0.5997    -0.3994 
   +0.1890    -0.3994    +0.2661 

 b3r3**6 = b3r3
   +0.1342    -0.2837    +0.1890 
   -0.2837    +0.5997    -0.3994 
   +0.1890    -0.3994    +0.2661 


 Press   return to continue
 Press X return to stop