X Value Decomposition

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


c00b.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RCA             RC3
#define FACTOR_E        +1.E-0   
/* ------------------------------------ */
/* ------------------------------------ */
double **X_cosh2A_mZ(
double **M_Value,
double **cosh2A_Value
)
{
int  r;
int  c;

nb_Z cosh2A;

  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)
          {
           cosh2A = cosh_Z(i_Z(2.*M_Value[r][c],2.*M_Value[r][c+C1]));
           
           cosh2A_Value[r][c   ] = cosh2A.r;
           cosh2A_Value[r][c+C1] = cosh2A.i;
          }
              
 return(cosh2A_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **X_TwocoshAP2mns1_mZ(
double **M_Value,
double **TwocoshAP2mns1_Value
)
{
int  r;
int  c;

nb_Z cosha;
nb_Z mns1 = {1,0};

nb_Z TwocoshAP2mns1;

  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)
          {
                     cosha = cosh_Z(i_Z( M_Value[r][c], M_Value[r][c+C1]));
           TwocoshAP2mns1 = sub_Z(smul_Z(2., mul_Z(cosha,cosha)),mns1); 
           
           TwocoshAP2mns1_Value[r][c   ] = TwocoshAP2mns1.r;
           TwocoshAP2mns1_Value[r][c+C1] = TwocoshAP2mns1.i;
          }
              
 return(TwocoshAP2mns1_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 **cosh2A         =      i_mZ(c,c);
double **TwocoshAP2mns1 =      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(" cosh(2*A)      :");
   X_cosh2A_mZ(X,cosh2A);
   
   mul_mZ(V,cosh2A,T1);
   mul_mZ(T1,U_T,cosh2A); 
   pE_mZ(cosh2A, S12,P4, S8,P4, C3);

   printf(" 2 coshA**2 - 1 :");
   X_TwocoshAP2mns1_mZ(X,TwocoshAP2mns1);
   
   mul_mZ(V,TwocoshAP2mns1,T1);
   mul_mZ(T1,U_T,TwocoshAP2mns1); 
   pE_mZ(TwocoshAP2mns1, 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(cosh2A);
   f_mZ(TwocoshAP2mns1);     
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

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


Exemple de sortie écran :
 A :
  -0.0400 -0.8900i   +0.7900 -0.3700i   -0.9300 +0.6300i 
  +0.1100 +0.2500i   -0.0800 +0.6500i   +0.1300 -0.2400i 
  -0.8300 +0.6500i   -0.7600 +0.8500i   +0.5700 +0.5600i 

 U :
  -0.5378 -0.3770i   +0.6297 +0.2738i   -0.1421 +0.2774i 
  +0.1218 +0.2700i   +0.2572 -0.1703i   -0.8667 -0.2566i 
  +0.6934 +0.0000i   +0.6583 -0.0000i   +0.2928 -0.0000i 

 V :
  -0.2464 +0.5355i   +0.1028 +0.2598i   +0.1249 -0.7476i 
  -0.4434 +0.3955i   +0.4133 -0.6372i   -0.0002 +0.2648i 
  +0.5473 -0.0000i   +0.5874 -0.0000i   +0.5962 +0.0000i 

 X = U_T * A * V :
  -0.3057 -1.2812i   +0.0000 +0.0000i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   +0.0170 +0.6155i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   +0.0000 +0.0000i   +0.4088 +0.6993i 

 Press return to continue. 


 cosh(2*A)      :
 +1.2922e-01+2.1941e-01i  -7.6137e-01+1.6961e-01i  +2.6067e-01-3.9022e-01i 
 +1.4190e-01+2.9955e-01i  +1.5268e-01-2.8727e-01i  +2.4382e-01-4.9643e-01i 
 +4.7780e-01-4.6698e-01i  -2.2409e-01-2.1923e-01i  -2.0939e-01+3.0425e-01i 

 2 coshA**2 - 1 :
 +1.2922e-01+2.1941e-01i  -7.6137e-01+1.6961e-01i  +2.6067e-01-3.9022e-01i 
 +1.4190e-01+2.9954e-01i  +1.5269e-01-2.8727e-01i  +2.4382e-01-4.9643e-01i 
 +4.7780e-01-4.6697e-01i  -2.2409e-01-2.1923e-01i  -2.0939e-01+3.0425e-01i 


 Press   return to continue
 Press X return to stop