Aller au contenu

Mathc complexes/01f

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_hermitian_mZ(i_mZ(rc,rc),9);
double **invA  =                i_mZ(rc,rc);
double **AinvA =                i_mZ(rc,rc);

  clrscrn();

  printf(" A : ");
  p_mZ(A, S8,P0, S6,P0, C5); 

  printf(" invA : ");
  p_mZ(invgj_mZ(A,invA), S8,P3, S6,P3, C5); 

  printf(" A * invA : ");
  p_mZ(mul_mZ(A,invA,AinvA), S8,P3, S6,P3, C5); 
    
  f_mZ(A);
  f_mZ(invA);
  f_mZ(AinvA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

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


Si l'inverse d'une matrice hermitienne existe, elle est hermitiennes.


Exemple de sortie écran :

 A : 
    +416    +0i       -5   +43i      +65  -106i     +158   -14i 
      -5   -43i     +223    +0i     -120    -3i     +134  +129i 
     +65  +106i     -120    +3i     +191    +0i      -90   -21i 
    +158   +14i     +134  -129i      -90   +21i     +320    +0i 

 invA : 
  +0.009-0.000i   -0.000-0.009i   -0.008+0.003i   -0.011+0.005i 
  -0.000+0.009i   +0.021-0.000i   +0.003-0.009i   -0.008-0.015i 
  -0.008-0.003i   +0.003+0.009i   +0.016-0.000i   +0.011-0.003i 
  -0.011-0.005i   -0.008+0.015i   +0.011+0.003i   +0.021-0.000i 

 A * invA : 
  +1.000-0.000i   +0.000-0.000i   -0.000+0.000i   +0.000+0.000i 
  -0.000-0.000i   +1.000+0.000i   +0.000-0.000i   +0.000-0.000i 
  +0.000+0.000i   -0.000+0.000i   +1.000+0.000i   +0.000+0.000i 
  +0.000+0.000i   +0.000-0.000i   +0.000-0.000i   +1.000-0.000i 


 Press   return to continue
 Press X return to stop