Aller au contenu

Mathc complexes/a86

Un livre de Wikilivres.

Application

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

c00b.c
/* ------------------------------------ */
/*  Save as :  c00b.c                   */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A =    r_mZ(     i_mZ(r,r),9);        
double **B =    r_mZ(     i_mZ(r,r),9);
double **AB = mul_mZ(A,B, i_mZ(r,r));
double **BA = mul_mZ(B,A, i_mZ(r,r));

  clrscrn();
  printf(" A : ");
  p_mZ(A, S5,P0, S5,P0, C6);        
  printf(" B : ");
  p_mZ(B, S5,P0, S5,P0, C6);          
  printf("\n\n"); 
  
  printf(" Trace(AB) = ");
  p_Z(trace_Z(AB), S4,P0, S3,P0); 
  printf("\n\n\n"); 
             
  printf(" Trace(BA) = ");
  p_Z(trace_Z(BA), S4,P0, S3,P0);    
  printf("\n\n\n"); 
  f_mZ(A);
  f_mZ(B);
  f_mZ(AB);
  f_mZ(BA);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n                                                  ");
  printf("\n                                                  ");
  printf("\n         Trace(AB) = Trace(BA):                   ");
  printf("\n         *********************                    ");
  printf("\n                                                  ");
  printf("\n                                                  ");
  printf("\n                                                  \n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  hello();

do{ 
  fun(rp_I(RC4));

} while(stop_w());

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


  La fonction trace se contente d'additionner tous les coefficients sur la diagonale.


Exemple de sortie écran :

 A : 
   -1   -7i    +3   +5i    +1   +1i    +4   -9i 
   -1   +9i    -6   +2i    -7   -3i    -3   -7i 
   -4   -8i    +1   -2i    -5   -8i    +6   +8i 
   -2   +9i    +8   -9i    +4   +3i    -8   +4i 

 B : 
   +9   -4i    -1   -1i    -2   +1i    +1   +1i 
   +2   +5i    +5   -3i    -3   -2i    +9   -8i 
   -5   -6i    -3   -9i    +2   -1i    -3   +9i 
   -7   -2i    -7   -7i    -4   +5i    +1   +9i 



 Trace(AB) = -316 -4i 


 Trace(BA) = -316 -4i 



 Press return to continue
 Press X      to stop