Aller au contenu

Mathc complexes/00d

Un livre de Wikilivres.


X Value Decomposition

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


c00a.c
/* ------------------------------------ */
/*  Xave as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E        +1.E-2   
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r,int c)
{
double **A      = r_mZ( i_mZ(r,c),99);	
double **Acc    =       i_mZ(c,c);

double **V      =       i_mZ(c,r);
double **U      =       i_mZ(c,r); 
double **V_T    =       i_mZ(r,c); 
double **V_TAcc =       i_mZ(r,c);  
double **X      =       i_mZ(r,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(V,V_T);

  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);
  
  f_mZ(A);  
  f_mZ(Acc);   
  f_mZ(V); 
  f_mZ(V_T);
  f_mZ(U); 
  f_mZ(V_TAcc);  
  f_mZ(X);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun(R3,C5);
    
} while(stop_w());

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


Exemple de sortie écran :
 A :
  -22  +5i   +34 +24i   +57 -55i   +29 +78i   +87 +68i 
  -24 -99i   +21 +63i   -45 -20i   -36 +49i   -54 +78i 
  +38 -74i   +14 -21i   +34 -13i   -43 +80i   +85 -76i 

 U :
   -0.2118 -0.0980i    +0.6311 -0.2216i    +0.1102 +0.3211i 
   +0.3114 +0.1421i    -0.0669 +0.0681i    +0.3308 -0.0277i 
   +0.1126 +0.1210i    +0.2772 -0.1266i    -0.7859 -0.0604i 
   +0.2875 -0.3361i    -0.4735 +0.2346i    -0.1560 +0.2676i 
   +0.7781 +0.0000i    +0.4140 +0.0000i    +0.2395 +0.0000i 

 V :
   +0.5304 +0.4523i    +0.0749 -0.0513i    -0.6422 -0.3058i 
   -0.2942 +0.5420i    +0.1635 -0.5088i    -0.0745 +0.5731i 
   +0.3658 +0.0000i    +0.8403 +0.0000i    +0.4001 +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 

 X = V_T * A * U :
 +213.5354 -31.8184i    -0.0000  -0.0000i    +0.0000  +0.0000i 
   +0.0000  +0.0000i   +62.6421-166.7308i    +0.0000  +0.0000i 
   +0.0000  +0.0000i    -0.0000  +0.0000i   +25.3552 -93.2639i 


 Press   return to continue
 Press X return to stop