Aller au contenu

Mathc complexes/00e

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 **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); 
  
  f_mZ(A);   
  f_mZ(V);
  f_mZ(V_T); 
  f_mZ(U);
  f_mZ(U_T);   
  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 :
  +62 +82i   -79 -77i   -60 +29i   -84 -66i   -51 -59i 
  -17 -94i   +83 +75i   -63 -93i   -68 +52i   -27 +22i 
  -58 -52i   +18 -77i    +5 -37i   -15 -45i   -27 -94i 

 U :
   -0.4804 +0.1901i    +0.3017 -0.1062i    +0.5949 -0.1870i 
   +0.6384 +0.1357i    -0.0436 -0.1172i    +0.3682 -0.0480i 
   -0.1425 +0.1561i    +0.5626 -0.2100i    -0.5283 -0.0582i 
   +0.3830 -0.1049i    +0.4842 +0.2149i    -0.2160 +0.0934i 
   +0.3237 +0.0000i    +0.4907 +0.0000i    +0.3680 -0.0000i 

 V :
   +0.1655 -0.7231i    +0.2272 -0.2334i    -0.2647 +0.5231i 
   -0.3227 +0.4870i    +0.5628 -0.4598i    -0.3228 +0.1623i 
   +0.3294 +0.0000i    +0.6048 +0.0000i    +0.7251 +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 :
 +138.2521-221.0227i    -0.0000  +0.0000i    -0.0000  +0.0000i 
   -0.0000  +0.0000i   -80.4024-167.4807i    -0.0000  -0.0000i 
   +0.0000  -0.0000i    -0.0000  +0.0000i   -67.0046 -77.6683i 

 A = V * X * U_T  
  +62 +82i   -79 -77i   -60 +29i   -84 -66i   -51 -59i 
  -17 -94i   +83 +75i   -63 -93i   -68 +52i   -27 +22i 
  -58 -52i   +18 -77i    +5 -37i   -15 -45i   -27 -94i 
   +0  +0i    +0  +0i    +0  +0i    +0  +0i    +0  +0i 
   +0  +0i    +0  +0i    +0  +0i    +0  +0i    +0  +0i 

 A :
  +62 +82i   -79 -77i   -60 +29i   -84 -66i   -51 -59i 
  -17 -94i   +83 +75i   -63 -93i   -68 +52i   -27 +22i 
  -58 -52i   +18 -77i    +5 -37i   -15 -45i   -27 -94i 


 Press   return to continue
 Press X return to stop