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 RCA             RC3
#define FACTOR_E        +1.E-0   
/* ------------------------------------ */
/* ------------------------------------ */
double **X_sin2A_mZ(
double **M_Value,
double **sin2A_Value
)
{
int  r;
int  c;
nb_Z a;

  for (   r=R1; r<M_Value[R_SIZE][C0]; r++)
    for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
          {
           a = sin_Z(i_Z(2.*M_Value[r][c],2.*M_Value[r][c+C1]));
           
           sin2A_Value[r][c   ] = a.r;
           sin2A_Value[r][c+C1] = a.i;
          }
              
 return(sin2A_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **X_DeuxcosAsinA_mZ(
double **M_Value,
double **DeuxcosAsinA_Value
)
{
int  r;
int  c;

nb_Z cosa;
nb_Z sina;

nb_Z DeuxcosAsinA;

  for (   r=R1; r<M_Value[R_SIZE][C0]; r++)
    for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
          {
           cosa = cos_Z(i_Z( M_Value[r][c], M_Value[r][c+C1]));
           sina = sin_Z(i_Z( M_Value[r][c], M_Value[r][c+C1]));
             
           DeuxcosAsinA = smul_Z(2., mul_Z(cosa,sina) ); 
           
           DeuxcosAsinA_Value[r][c   ] = DeuxcosAsinA.r;
           DeuxcosAsinA_Value[r][c+C1] = DeuxcosAsinA.i;
          }
              
 return(DeuxcosAsinA_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
int r = RCA;
int c = RCA;
  
double **A =           rE_mZ(i_mZ(r,c),999,+1.E-4);

double **A_T = ctranspose_mZ(A,i_mZ(c,r));
double **V =                   i_mZ(r,c);
double **V_T =                 i_mZ(c,r);
double **U =                   i_mZ(r,c);
double **U_T =                 i_mZ(c,r);  
double **U_TA =                i_mZ(c,c);  
double **X =                   i_mZ(c,c);  

double **T1        =           i_mZ(c,c);

double **sin2A     =           i_mZ(c,c);
double **DeuxcosAsinA =        i_mZ(c,c);

  clrscrn();
  printf(" A :");
  p_mZ(A, S9,P4, S8,P4, C3);
      
  printf(" U :");
  X_U_mZ(A_T,U,FACTOR_E);
  p_mZ(U, S9,P4, S8,P4, C3);

  printf(" V :");
  X_V_mZ(A_T,V,FACTOR_E);
  p_mZ(V, S9,P4, S8,P4, C3);
  
   ctranspose_mZ(U,U_T);
   ctranspose_mZ(V,V_T);  
   
   printf(" X = U_T * A * V :");
   mul_mZ(U_T, A, U_TA);                      
   mul_mZ(U_TA, V, X);  
   p_mZ(X, S9,P4, S8,P4, C3);
   stop();

   clrscrn();
   printf(" sin(2*A)        :");
   X_sin2A_mZ(X,sin2A);
   
   mul_mZ(V,sin2A,T1);
   mul_mZ(T1,U_T,sin2A); 
   pE_mZ(sin2A, S12,P4, S8,P4, C3);

   printf(" 2 cosA sinA :");
   X_DeuxcosAsinA_mZ(X,DeuxcosAsinA);
   
   mul_mZ(V,DeuxcosAsinA,T1);
   mul_mZ(T1,U_T,DeuxcosAsinA); 
   pE_mZ(DeuxcosAsinA, S12,P4, S8,P4, C3);
                
   f_mZ(A);
   f_mZ(A_T);
   
   f_mZ(V);
   f_mZ(V_T);
   
   f_mZ(U);
   f_mZ(U_T);
   f_mZ(U_TA);
   f_mZ(X);
   
   f_mZ(sin2A);
   f_mZ(DeuxcosAsinA);     
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

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


Exemple de sortie écran :
 A :
  -0.1400 -0.5700i   -0.3900 -0.6500i   +0.9100 +0.7000i 
  -0.6600 +0.8300i   -0.0300 -0.3100i   -0.0500 +0.3200i 
  -0.2000 -0.2600i   +0.0200 +0.9500i   +0.3800 +0.7800i 

 U :
  +0.8404 +0.0339i   -0.5061 -0.0547i   -0.1776 +0.0438i 
  -0.0593 +0.1139i   -0.4016 +0.2853i   +0.6623 -0.5498i 
  +0.5255 -0.0000i   +0.7058 +0.0000i   +0.4751 +0.0000i 

 V :
  -0.4572 -0.1934i   +0.0528 +0.3250i   +0.7733 +0.2172i 
  -0.1301 +0.1015i   -0.2044 -0.9044i   +0.2997 +0.1525i 
  +0.8522 +0.0000i   +0.1786 +0.0000i   +0.4917 +0.0000i 

 X = U_T * A * V :
  +0.8619 +1.0652i   +0.0000 +0.0000i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   +0.9887 -0.2101i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   +0.0000 +0.0000i   -0.8749 +0.2486i 

 Press return to continue. 


 sin(2*A)        :
 -1.6234e+00-4.5039e-01i  -2.2458e-01-5.3543e-01i  -1.4775e+00-1.8909e-01i 
 -2.6537e-01+9.6734e-01i  -2.6385e-01+1.1156e-01i  -4.4091e-01-4.8869e-01i 
 +3.0056e+00-5.4870e-01i  -6.7352e-01-7.7024e-01i  +1.7565e+00-2.8320e-01i 

 2 cosA sinA :
 -1.6234e+00-4.5036e-01i  -2.2457e-01-5.3543e-01i  -1.4775e+00-1.8908e-01i 
 -2.6537e-01+9.6735e-01i  -2.6385e-01+1.1156e-01i  -4.4091e-01-4.8868e-01i 
 +3.0056e+00-5.4875e-01i  -6.7353e-01-7.7024e-01i  +1.7566e+00-2.8323e-01i 


 Press   return to continue
 Press X return to stop