Mathc matrices/e1502

Un livre de Wikilivres.


Étude du code


Installer et compiler ces fichiers dans votre répertoire de travail.


gj02.c
/* ------------------------------------ */
/*  Save as :   gj02.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **xx_sort_c_mR(
double **Ab
)
{
double **T = i_RC_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]);
int c;

  for(c=C1; c<Ab[C_SIZE][C0]; c++)

           c_c_withR0_mR(  Ab,        c,
                            T, Ab[R0][c]);
 c_withR0_mR(T,Ab);
  
 f_mR(T);
 
 return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **XX_gj_TP_mR(
double **Ab
)
{
   gj1_T_mR(Ab);
   
   xx_sort_c_mR(Ab);
  
   //sort_r_mR(Ab);
  
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A  = i_mR(r,r);
double **b  = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,r,C1);
/*            i_Abr_Ac_bc_mR(R_Ab,C_A,C_b));  */

 do
  {
   r_mR(A,999.);
   printf(".");
  }while(!det_R(A));

  r_mR(b,999.);
  c_A_b_Ab_mR(A,b,Ab);
  
  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf("\n rref(Ab,.00000000001)\n\n");
  stop();

  clrscrn();
  XX_gj_TP_mR(Ab);
  printf("  gj_TP_mR(Ab) :\n");
  p_mR(Ab,S10,P4,C7);
  
  
  f_mR(Ab);
  f_mR(b);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(R2)+R2);


} while(stop_w());

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


Nous avons introduit la fonction sort_c_mR(); que nous allons étudier. Comme cette fonction est dans la bibliothèque, nous allons l'appeler xx_sort_c_mR();


Exemple de sortie écran :
 ------------------------------------ 
 Copy/Past into the octave window.

 Ab=[
+216,+444,+346,-369,-497;
-137,+36,-925,+896,+350;
-319,+776,+360,+206,+354;
+186,-19,+662,-29,+42]


 rref(Ab,.00000000001)

 Press return to continue. 


  gj_TP_mR(Ab) :
  +1.00000   +0.00000   +0.00000   +0.00000   -1.11031 
  -0.00000   +1.00000   +0.00000   +0.00000   -0.35293 
  +0.00000   +0.00000   +1.00000   +0.00000   +0.39336 
  +0.00000   +0.00000   +0.00000   +1.00000   +0.64113 


 Press return to continue
 Press X      to stop