Mathc matrices/Fichiers c : transpose

Un livre de Wikilivres.


Application

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

transpose.c
/* ------------------------------------ */
/*  Save as :  transpose.c              */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r,int c)
{
double **A   = r_mR(i_mR(r,c),9);
double **A_t =      i_mR(c,r);

  clrscrn();
  printf(" A \n");
  p_mR(A,3,0,C6);

  printf("\n A^t  (transpose)\n");
  p_mR(transpose_mR(A,A_t),S3,P0,C6);

  f_mR(A);
  f_mR(A_t);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
  do 
         fun(rp_I(R6),rp_I(C6));
        
    while(stop_w());

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


   Tester la bibliothèque.


Exemple de sortie écran :

A 

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


 A^t  (transpose)

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


 Press return to continue
 Press X      to stop