Aller au contenu

Mathc complexes/00n

Un livre de Wikilivres.

Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A      =          r_mZ(        i_mZ(rc,rc),9);
double **invA   =        inv_mZ(A,     i_mZ(rc,rc));
double **A_CT    = ctranspose_mZ(A,    i_mZ(rc,rc));
double **invA_CT =        inv_mZ(A_CT, i_mZ(rc,rc));
double **IDE    =                      i_mZ(rc,rc);

  clrscrn();
  printf(" A : ");
  p_mZ(A, S5,P4, S4,P4, C6);
  printf(" invA : ");
  p_mZ(invA, S5,P4, S4,P4, C6);
  printf(" A * invA : ");
  p_mZ(mul_mZ(A,invA,IDE), S5,P4, S4,P4, C6);
  stop();

  clrscrn();
  printf(" A_CT : Conjugate Transpose");
  p_mZ(A_CT, S5,P4, S4,P4, C6);
  printf(" invA_CT : ");
  p_mZ(invA_CT, S5,P4, S4,P4, C6);
  printf(" A_CT * invA_CT : ");
  p_mZ(mul_mZ(A_CT,invA_CT,IDE), S5,P4, S4,P4, C6); 
  stop();

  clrscrn();
  printf(" invA : ");
  p_mZ(invA, S5,P4, S4,P4, C6);
  printf(" invA_CT : ");
  p_mZ(invA_CT, S5,P4, S4,P4, C6);
      
  f_mZ(A);
  f_mZ(invA);
  f_mZ(A_CT);
  f_mZ(invA_CT);
  f_mZ(IDE);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC3)+RC1);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


L'inverse de la transposée conjuguée d'une matrice est égale à la transposée conjuguée de l'inverse de la matrice

Exemple de sortie écran :

 A : 
-7.0000-3.0000i -1.0000-1.0000i -9.0000+5.0000i 
+4.0000+4.0000i +4.0000-8.0000i +3.0000+1.0000i 
-9.0000-4.0000i -1.0000+3.0000i +5.0000-4.0000i 

 invA : 
-0.0466+0.0177i -0.0238+0.0042i -0.0705+0.0244i 
-0.0065+0.0493i +0.0471+0.1061i +0.0079+0.0284i 
-0.0467-0.0289i +0.0255+0.0018i +0.0497+0.0281i 

 A * invA : 
+1.0000+0.0000i -0.0000+0.0000i +0.0000+0.0000i 
+0.0000+0.0000i +1.0000-0.0000i -0.0000+0.0000i 
+0.0000-0.0000i +0.0000+0.0000i +1.0000+0.0000i 

 Press return to continue. 


 A_CT : Conjugate Transpose
-7.0000+3.0000i +4.0000-4.0000i -9.0000+4.0000i 
-1.0000+1.0000i +4.0000+8.0000i -1.0000-3.0000i 
-9.0000-5.0000i +3.0000-1.0000i +5.0000+4.0000i 

 invA_CT : 
-0.0466-0.0177i -0.0065-0.0493i -0.0467+0.0289i 
-0.0238-0.0042i +0.0471-0.1061i +0.0255-0.0018i 
-0.0705-0.0244i +0.0079-0.0284i +0.0497-0.0281i 

 A_CT * invA_CT : 
+1.0000-0.0000i +0.0000+0.0000i +0.0000+0.0000i 
+0.0000+0.0000i +1.0000+0.0000i +0.0000+0.0000i 
+0.0000+0.0000i +0.0000+0.0000i +1.0000-0.0000i 

 Press return to continue. 


 invA : 
-0.0466+0.0177i -0.0238+0.0042i -0.0705+0.0244i 
-0.0065+0.0493i +0.0471+0.1061i +0.0079+0.0284i 
-0.0467-0.0289i +0.0255+0.0018i +0.0497+0.0281i 

 invA_CT : 
-0.0466-0.0177i -0.0065-0.0493i -0.0467+0.0289i 
-0.0238-0.0042i +0.0471-0.1061i +0.0255-0.0018i 
-0.0705-0.0244i +0.0079-0.0284i +0.0497-0.0281i 


 Press   return to continue
 Press X return to stop