X Value Decomposition


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


c00c.c
/* ------------------------------------ */
/*  save as :   c00.c                   */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E        +1.E-2   
/* ------------------------------------ */
#define    RC           RC3
#define    Cb            C3
/* ------------------------------------ */
int main(void)
{
double a[RC*(RC*C2)] ={ 1,2,  3,4,  5,6,
                        5,4,  1,3,  6,8,
                        7,2,  5,1,  1,1};

double t[RC*(Cb*C2)] ={ 1,2, 2,3, 3,5, 
                        3,4, 2,4, 3,4, 
                        5,6, 2,5, 3,3 };
                                                
double **A = ca_A_mZ(a,i_mZ(RC,RC));
double **b = ca_A_mZ(t,i_mZ(RC,Cb));
double **x =           i_mZ(RC,Cb);

double **A_T   = ctranspose_mZ(A,               i_mZ(RC,RC));
double **V     =        X_V_mZ(A_T,             i_mZ(RC,RC),FACTOR_E);
double **V_T   = ctranspose_mZ(V,               i_mZ(RC,RC));  
double **U     =        X_U_mZ(A_T,             i_mZ(RC,RC),FACTOR_E);
double **U_T   = ctranspose_mZ(U,               i_mZ(RC,RC));
double **U_TA  =                                i_mZ(RC,RC); 
double **X     = mul_mZ(mul_mZ(U_T, A, U_TA), V,i_mZ(RC,RC));
double **invX  = X_inv_mZ(X,                    i_mZ(RC,RC)); 
double **VinvX = mul_mZ(V, invX,                i_mZ(RC,RC));
double **Pinv  =  mul_mZ(VinvX, U_T,            i_mZ(RC,RC));

  clrscrn();  
  printf(" A :");
  p_mZ(A, S8,P2, S8,P2, C4);
  printf(" b :");
  p_mZ(b, S8,P2, S8,P2, C4);   
  stop();  
 
  clrscrn();       
  printf(" x = inv b  ");   
  mul_mZ(Pinv, b, x); 
  pE_mZ(x, S12,P4, S12,P4, C4);  

  printf(" B :");
  p_mZ(b, S7,P2, S4,P2, C4);
  printf("  Ax :");
  p_mZ(mul_mZ(A,x,b), S7,P2, S4,P2, C4);
  
  stop();     
   f_mZ(A);
   f_mZ(A_T);

   f_mZ(b);
   f_mZ(x);
      
   f_mZ(V);
   f_mZ(V_T);
     
   f_mZ(U);
   f_mZ(U_T);
   f_mZ(U_TA);
   f_mZ(X);
   
   f_mZ(invX);
   f_mZ(VinvX);
   f_mZ(Pinv);  
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */



Exemple de sortie écran :
 A :
   +1.00   +2.00i    +3.00   +4.00i    +5.00   +6.00i 
   +5.00   +4.00i    +1.00   +3.00i    +6.00   +8.00i 
   +7.00   +2.00i    +5.00   +1.00i    +1.00   +1.00i 

 b :
   +1.00   +2.00i    +2.00   +3.00i    +3.00   +5.00i 
   +3.00   +4.00i    +2.00   +4.00i    +3.00   +4.00i 
   +5.00   +6.00i    +2.00   +5.00i    +3.00   +3.00i 

 Press return to continue. 


 x = inv b  
 +6.5984e-01 +4.7452e-01i  +1.0825e-01 +4.0881e-01i  -1.2855e-02 -5.7820e-03i 
 +2.7038e-01 +2.8544e-01i  +3.7284e-01 +3.2225e-01i  +5.9293e-01 +4.5833e-01i 
 -3.7593e-02 -3.0130e-01i  +2.2785e-01 -2.9010e-01i  +3.7685e-01 -1.9527e-01i 

 B :
  +1.00+2.00i   +2.00+3.00i   +3.00+5.00i 
  +3.00+4.00i   +2.00+4.00i   +3.00+4.00i 
  +5.00+6.00i   +2.00+5.00i   +3.00+3.00i 

  Ax :
  +1.00+2.00i   +2.00+3.00i   +3.00+5.00i 
  +3.00+4.00i   +2.00+4.00i   +3.00+4.00i 
  +5.00+6.00i   +2.00+5.00i   +3.00+3.00i 

 Press return to continue.