Aller au contenu

Mathc complexes/00b

Un livre de Wikilivres.


X Value Decomposition

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


c00a.c
/* ------------------------------------ */
/*  save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RA              R3
#define CA              C5
/* ------------------------------------ */
#define FACTOR_E        +1.E-2   
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
int r = RA;
int c = CA;  

double a[RA*(CA*C2)] ={    
   +4, +28,   -82, +58,    -5,  -6,   +30, +46,   -76, -17, 
  +65, -51,   +25, +86,   +78, +53,    +8, +74,   +94, -93, 
  +93, -18,   -38, -50,   -61, +27,   +49, +17,   -98, +43
  };

double **A      = ca_A_mZ(a, i_mZ(r,c));     
double **Acc    =       i_mZ(c,c);

double **V      =       i_mZ(c,r);
double **U      =       i_mZ(c,r);
double **U_T    =       i_mZ(r,c);   
double **V_T    =       i_mZ(r,c);  
double **V_TAcc =       i_mZ(r,c); 
double **X      =       i_mZ(r,r);  
double **VX     =       i_mZ(c,r);

  clrscrn();
  printf(" A :");
  p_mZ(A, S5,P0, S4,P0, C6);
        
  printf(" U :");
  X_U_mZ(A,U,FACTOR_E);
    p_mZ(U, S10,P4, S8,P4, C3);

  printf(" V :");
  X_V_mZ(A,V,FACTOR_E);
    p_mZ(V, S10,P4, S8,P4, C3); 
 
  ctranspose_mZ(U,U_T);
  ctranspose_mZ(V,V_T);
  stop();
   
  clrscrn(); 
  printf(" X = V_T * A * U :");
  c_mZ(A, Acc);
  mul_mZ(V_T,  Acc, V_TAcc);          
  mul_mZ(V_TAcc, U,  X);             
  p_mZ(X, S10,P4, S9,P4, C3);
  
   printf(" A = V * X * U_T  ");
   mul_mZ(V, X, VX);                    
   mul_mZ(VX, U_T, Acc);                 
   p_mZ(Acc, S5,P0, S4,P0, C6);  

  printf(" A :");
  p_mZ(A, S5,P0, S4,P0, C6); 
  stop();
  
  f_mZ(A);   
  f_mZ(V);
  f_mZ(V_T); 
  f_mZ(U);
  f_mZ(U_T);   
  f_mZ(V_TAcc);   
  f_mZ(X);

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


Exemple de sortie écran :
 A :
   +4 +28i   -82 +58i    -5  -6i   +30 +46i   -76 -17i 
  +65 -51i   +25 +86i   +78 +53i    +8 +74i   +94 -93i 
  +93 -18i   -38 -50i   -61 +27i   +49 +17i   -98 +43i 

 U :
   +0.1099 +0.1622i    -0.4664 -0.3321i    +0.5659 +0.2034i 
   -0.0258 -0.4271i    +0.0870 +0.3941i    +0.4715 +0.5624i 
   +0.2812 -0.3546i    -0.0783 +0.1849i    -0.1710 -0.1862i 
   -0.1782 -0.0962i    -0.4939 +0.2407i    -0.0196 +0.0143i 
   +0.7299 +0.0000i    +0.4088 +0.0000i    +0.1878 -0.0000i 

 V :
   +0.1567 +0.0612i    +0.5488 +0.2104i    -0.7386 -0.2842i 
   -0.8170 -0.1463i    +0.5096 +0.0905i    +0.2045 +0.0375i 
   +0.5318 -0.0000i    +0.6218 +0.0000i    +0.5749 -0.0000i 
   +0.0000 +0.0000i    +0.0000 +0.0000i    +0.0000 +0.0000i 
   +0.0000 +0.0000i    +0.0000 +0.0000i    +0.0000 +0.0000i 

 Press return to continue. 


 X = V_T * A * U :
 -175.7101+156.9912i    -0.0000  +0.0000i    +0.0000  -0.0000i 
   +0.0000  +0.0000i  -163.2623 -55.0545i    +0.0000  -0.0000i 
   -0.0000  +0.0000i    +0.0000  +0.0000i  +108.4528 -36.5673i 

 A = V * X * U_T  
   +4 +28i   -82 +58i    -5  -6i   +30 +46i   -76 -17i 
  +65 -51i   +25 +86i   +78 +53i    +8 +74i   +94 -93i 
  +93 -18i   -38 -50i   -61 +27i   +49 +17i   -98 +43i 
   +0  +0i    +0  +0i    +0  +0i    +0  +0i    +0  +0i 
   +0  +0i    +0  +0i    +0  +0i    +0  +0i    +0  +0i 

 A :
   +4 +28i   -82 +58i    -5  -6i   +30 +46i   -76 -17i 
  +65 -51i   +25 +86i   +78 +53i    +8 +74i   +94 -93i 
  +93 -18i   -38 -50i   -61 +27i   +49 +17i   -98 +43i 

 Press return to continue.