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   
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc, int cb)
{
double **A = r_mZ(i_mZ(rc,rc),99);
double **b = r_mZ(i_mZ(rc,cb),99);
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, S6,P2, C4);
  printf(" b :");
  p_mZ(b, S8,P2, S6,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, S8,P2, S8,P2, C4);   
  printf("  Ax :");
  p_mZ(mul_mZ(A,x,b), S8,P2, S8,P2, C4);   
    
   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);  
 }
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun(R4,C3);
    
} while(stop_w());

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



Exemple de sortie écran :
 A :
  -39.00 +6.00i   +11.00+28.00i   -71.00-24.00i   -16.00-21.00i 
  -26.00-81.00i   -18.00-19.00i   -14.00-79.00i   -84.00 +5.00i 
  +95.00+50.00i   +21.00-76.00i   +49.00-94.00i   -29.00-88.00i 
  -96.00+81.00i   -58.00+40.00i   -69.00-53.00i   -62.00-74.00i 

 b :
  +62.00-59.00i   -99.00+73.00i   +28.00 +8.00i 
  -77.00 -8.00i   +60.00+82.00i   -87.00-88.00i 
  +39.00 -7.00i   +94.00-54.00i    +3.00-37.00i 
  -44.00-44.00i   +73.00-26.00i   -44.00-20.00i 

 Press return to continue. 


 x = inv b  
 +6.6805e-01 +1.2853e-01i  -1.1083e+00 -1.1831e+00i  +4.9084e-01 +4.3386e-01i 
 +4.4698e-01 -4.3244e-01i  -6.2949e-01 +2.1667e+00i  +3.5160e-01 -3.8765e-01i 
 -1.0026e+00 +7.5260e-01i  +1.0829e+00 -1.9054e-01i  -5.0857e-01 -4.9943e-01i 
 +1.4967e+00 +3.0944e-01i  -1.1919e+00 -9.2087e-01i  +6.9190e-01 +1.0463e+00i 

 B :
  +62.00  -59.00i   -99.00  +73.00i   +28.00   +8.00i 
  -77.00   -8.00i   +60.00  +82.00i   -87.00  -88.00i 
  +39.00   -7.00i   +94.00  -54.00i    +3.00  -37.00i 
  -44.00  -44.00i   +73.00  -26.00i   -44.00  -20.00i 

  Ax :
  +62.00  -59.00i   -99.00  +73.00i   +28.00   +8.00i 
  -77.00   -8.00i   +60.00  +82.00i   -87.00  -88.00i 
  +39.00   -7.00i   +94.00  -54.00i    +3.00  -37.00i 
  -44.00  -44.00i   +73.00  -26.00i   -44.00  -20.00i 


 Press   return to continue
 Press X return to stop