Aller au contenu

Mathc complexes/a338

Un livre de Wikilivres.


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_sinh2A_mZ(
double **M_Value,
double **sinh2A_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 = sinh_Z(i_Z(2.*M_Value[r][c],2.*M_Value[r][c+C1]));
           
           sinh2A_Value[r][c   ] = a.r;
           sinh2A_Value[r][c+C1] = a.i;
          }
              
 return(sinh2A_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **X_DeuxcoshAsinhA_mZ(
double **M_Value,
double **DeuxcoshAsinhA_Value
)
{
int  r;
int  c;

nb_Z cosha;
nb_Z sinha;

nb_Z DeuxcoshAsinhA;

  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]));
           sinha = sinh_Z(i_Z( M_Value[r][c], M_Value[r][c+C1]));
             
           DeuxcoshAsinhA = smul_Z(2., mul_Z(cosha,sinha) ); 
           
           DeuxcoshAsinhA_Value[r][c   ] = DeuxcoshAsinhA.r;
           DeuxcoshAsinhA_Value[r][c+C1] = DeuxcoshAsinhA.i;
          }
              
 return(DeuxcoshAsinhA_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 **sinh2A     =           i_mZ(c,c);
double **DeuxcoshAsinhA =        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(" sinh(2*A)        :");
   X_sinh2A_mZ(X,sinh2A);
   
   mul_mZ(V,sinh2A,T1);
   mul_mZ(T1,U_T,sinh2A); 
   pE_mZ(sinh2A, S12,P4, S8,P4, C3);

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

  srand(time(&t));

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

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


Exemple de sortie écran :
 A :
  -0.2100 +0.1300i   -0.0800 -0.0300i   -0.2200 -0.0200i 
  -0.8900 -0.8700i   +0.0400 +0.9200i   -0.6800 +0.6800i 
  +0.3200 -0.5400i   -0.6000 -0.4100i   -0.9100 -0.9000i 

 U :
  +0.0063 +0.0564i   +0.3877 +0.2082i   -0.7452 -0.4978i 
  -0.0600 +0.7535i   +0.0203 -0.5974i   +0.0721 -0.2574i 
  +0.6523 -0.0000i   +0.6701 +0.0000i   +0.3542 +0.0000i 

 V :
  +0.0442 +0.5677i   +0.3507 -0.5746i   -0.4565 -0.1195i 
  +0.4065 -0.2535i   +0.1386 +0.4658i   -0.7077 -0.1831i 
  +0.6680 +0.0000i   +0.5574 +0.0000i   +0.4929 -0.0000i 

 X = U_T * A * V :
  -0.2309 -0.4889i   +0.0000 +0.0000i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   -0.8925 -1.6922i   +0.0000 +0.0000i 
  +0.0000 +0.0000i   +0.0000 +0.0000i   -0.1846 +0.1320i 

 Press return to continue. 


 sinh(2*A)        :
 +1.5069e-01-6.8737e-01i  +6.9823e-01+4.8880e-01i  +1.3498e+00-1.0630e+00i 
 +1.2628e-01+8.0681e-01i  -9.9669e-01+4.0070e-01i  -8.4092e-02+7.0043e-01i 
 +7.2327e-01-3.5140e-01i  -7.1579e-01+1.0794e+00i  +8.6982e-01-7.4528e-02i 

 2 coshA sinhA :
 +1.4898e-01-6.8751e-01i  +6.9944e-01+4.8680e-01i  +1.3476e+00-1.0644e+00i 
 +1.2719e-01+8.0596e-01i  -9.9620e-01+4.0231e-01i  -8.2261e-02+6.9995e-01i 
 +7.2264e-01-3.5267e-01i  -7.1385e-01+1.0793e+00i  +8.6988e-01-7.6699e-02i 


 Press   return to continue
 Press X return to stop