Aller au contenu

Mathc complexes/a271

Un livre de Wikilivres.


Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E    +1.E-2         
#define RCA          RC4  
/* ------------------------------------ */
void fun(void)
{                          
double **A    =          r_mZ(       i_mZ(RCA,RCA),99);
double **A_T  = ctranspose_mZ(A,     i_mZ(RCA,RCA)   );
double **A_TA =        mul_mZ(A_T,A, i_mZ(RCA,RCA)   );

double **P                  = i_mZ(RCA,RCA);

double **EigsVector         = i_mZ(RCA,RCA);
double **EigsVector_T       = i_mZ(RCA,RCA);
double **EigsValue          = i_mZ(RCA,RCA);
double **SqrtEigsValue      = i_mZ(RCA,RCA);

double **T                  = i_mZ(RCA,RCA);

  clrscrn();
  printf(" A :");
  p_mZ(A, S7,P0, S7,P0, C6); 

  printf(" A_TA :");
  p_mZ(A_TA, S7,P0, S7,P0, C6); 
  
/* EigsVector and EigsVector_T*/    
  eigs_V_mZ(A_TA,EigsVector,FACTOR_E);
  ctranspose_mZ(EigsVector,EigsVector_T);
    
/* EigsValue = EigsVector_T * A_TA * EigsVector */   
  mul_mZ(EigsVector_T,A_TA,T);
  mul_mZ(T,EigsVector,EigsValue); 
  
//  printf(" EigsValue :");
//  p_mZ(EigsValue, S7,P0, S7,P0, C6);   
   
  f_eigs_mZ(sqrt,EigsValue,SqrtEigsValue); 

/* P = EigsVector * sqrt(EigsValue) * EigsVector_T*/     
  mul_mZ(EigsVector,SqrtEigsValue,T);
  mul_mZ(T,EigsVector_T,P);          
  printf(" P = (A_TA)**(1/2)\n"
         "   = EigsVector * sqrt(EigsValue) * EigsVector_T");
  p_mZ(P, S9,P3, S8,P3, C6);  
  
  f_mZ(A);
  f_mZ(A_T);
  f_mZ(A_TA);
      
  f_mZ(P);
      
  f_mZ(EigsVector);
  f_mZ(EigsVector_T);
  
  f_mZ(T); 
  
  f_mZ(SqrtEigsValue);
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

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


Exemple de sortie écran :

 ------------------------------------
 A :
    -42     -3i     -71    -83i     +60    +51i     -94    +73i 
     +8    +60i     +42    -54i     -51    +27i     -21    +99i 
    -12     -6i     +86    +20i     +90    +45i     +71    -81i 
    -37    +49i     +25    +88i      -4     -3i     +29    +82i 

 A_TA :
  +9387     +0i   +2562  -3884i   -2810  +1621i  +12080  -4353i 
  +2562  +3884i  +32775     +0i   -3817  +2086i   +6814 -18849i 
  -2810  -1621i   -3817  -2086i  +19681     +0i   +4210  -6034i 
 +12080  +4353i   +6814 +18849i   +4210  +6034i  +43574     +0i 

 P = (A_TA)**(1/2)
   = EigsVector * sqrt(EigsValue) * EigsVector_T
  +61.494  +0.000i    -0.379 -33.438i   -25.515  -0.090i   +59.377 -17.627i 
   -0.379 +33.438i  +164.339  +0.000i   -19.076 +12.960i   +18.141 -61.551i 
  -25.515  +0.090i   -19.076 -12.960i  +132.242  +0.000i   +21.576 -23.338i 
  +59.377 +17.627i   +18.141 +61.551i   +21.576 +23.338i  +186.037  +0.000i 


 Press   return to continue
 Press X return to stop