Mathc matrices/e1606

Un livre de Wikilivres.


Étude du code


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


gj06.c
/* ------------------------------------ */
/*  Save as :   gj06.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void xx_gj3_T_mR(
double **Ab,
int below
)
{
int r= R1;
int c= C1;

    while( (r<Ab[R_SIZE][C0]) &&
           (c<Ab[C_SIZE_A][C0]) )
       {
        if(pivotbest_gj3Ab_mR(Ab,r,c)>ERROR_E) 
        
           zero_under_pivot_gj3Ab_mR(Ab,r,c);
           
        else r--;
        
        r++;
        c++;
       }

 r = Ab[R_SIZE][C0];
 
 if(below)
 
 while(r>R1)
  {
   r--;
   c=C1;
   
   while(fabs(Ab[r][c])<ERROR_E  &&  c<(Ab[C_SIZE_A][C0]-C1) ) c++;
         
   if(fabs(Ab[r][c])>ERROR_E)
   
      zero_below_pivot_gj3Ab_mR(Ab,r,c);
  }
}
/* ------------------------------------ */
double **XX_gj_PP_mR(
double **Ab,
int below
)
{
   xx_gj3_T_mR(Ab,below);
  
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_PP_mR(Ab,YES);
  printf("  gj_PP_mR(Ab,YES) :");
  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(R5);


} while(stop_w());

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


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



Exemple de sortie écran :
 ------------------------------------ 

 Copy/Past into the octave window.

 Ab=[
+174,-351,+924,+582;
+510,+864,-989,+186;
-889,+632,+844,+488]


 rref(Ab,.00000000001)

 Press return to continue. 


  gj_PP_mR(Ab,YES) :
  +1.00000   +0.00000   +0.00000   +0.67398 
  +0.00000   +1.00000   +0.00000   +0.69564 
  +0.00000   +0.00000   +1.00000   +0.76721 


 Press return to continue
 Press X      to stop