Mathc complexes/Fichiers c : trace

Application

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

trace.c
/* ------------------------------------ */
/*  Save as :  trace.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A   = r_mZ(i_mZ(rc,rc),9);

   clrscrn();

   printf("  A\n");
   p_mZ(A, S5,P0, S4,P0,C6);

   printf("\n\n\n Trace of the matrix A = ");
   p_Z(trace_Z(A), S5,P0, S4,P0);
   printf("\n\n\n");
    
  f_mZ(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC5));
        
    while(stop_w());

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


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


Exemple de sortie écran :

    A

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




 Trace of the matrix A =   +12  -7i 



 Press return to continue
 Press X      to stop