Exemple de sortie écran :
/* --------- DEBUG 1 ---------- */
 Copy C[1] of Ab into C[2] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][2]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 Press return to continue. 
/* --------- DEBUG 1 ---------- */
 Copy C[2] of Ab into C[1] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][1]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 Press return to continue. 
/* --------- DEBUG 1 ---------- */
 Copy C[3] of Ab into C[3] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][3]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 
 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 
 Press return to continue. 
/* --------- DEBUG 1 ---------- */
 Copy C[4] of Ab into C[5] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][5]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0000 
 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.0017 +0.0000 
 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 -0.0221 +0.0000 
 Press return to continue. 
/* --------- DEBUG 1 ---------- */
 Copy C[5] of Ab into C[4] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][4]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0316 -0.0155 +0.0000 
 +0.0000 +1.0000 +0.0000 +0.0000 -0.0132 -0.0017 +0.0000 
 +0.0000 +0.0000 +0.0000 +1.0000 +0.0770 -0.0221 +0.0000 
 Press return to continue. 
/* --------- DEBUG 1 ---------- */
 Copy C[6] of Ab into C[6] of T
 +4.0000 +2.0000 +1.0000 +3.0000 +5.0000 +4.0000 +6.0000 
 +7.0000 +1.0000 +0.0000 +0.0000 -0.0155 +0.0316 +0.0013 
 +4.0000 +0.0000 +1.0000 +0.0000 -0.0017 -0.0132 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 -0.0221 +0.0770 +0.0165 
 T[R0][6]
 +4.0000 +1.0000 +2.0000 +3.0000 +4.0000 +5.0000 +6.0000 
 +7.0000 +0.0000 +1.0000 +0.0000 +0.0316 -0.0155 +0.0013 
 +0.0000 +1.0000 +0.0000 +0.0000 -0.0132 -0.0017 +0.0049 
 +0.0000 +0.0000 +0.0000 +1.0000 +0.0770 -0.0221 +0.0165 
 Press return to continue. 
 Copy/Past into the octave window.
format short e
 A=[
-37,-13,+12;
-69,-97,+28;
+80,-69,+42]
 inv(A)
 -1.3164e-02 -1.7331e-03 +4.9167e-03 
 +3.1577e-02 -1.5451e-02 +1.2783e-03 
 +7.6952e-02 -2.2082e-02 +1.6545e-02 
 A * inv(A)
 +1.0000 -0.0000 +0.0000 
 +0.0000 +1.0000 +0.0000 
 +0.0000 -0.0000 +1.0000 
 Press return to continue
 Press X to stop

Mathc matrices/c09a10
Étude du code
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : inv10.c */
/* ------------------------------------ */
double **xx_sort_r_mR(
double **Ab
double pivot;
int c;
int r;
int r_pivot = R1;
 for ( c=C1; c<Ab[C_SIZE_A][C0]; c++)
 r = r_pivot;
 pivot = 0.;
 while( (pivot<ERROR_E) && r<Ab[R_SIZE][C0] )
 pivot = fabs( Ab[r][c] );
 if(pivot>ERROR_E) 
 swapR_mR(Ab, r, r_pivot);
 r_pivot++;
 r++;
 return(Ab);
/* ------------------------------------ */
double **XX_invgj_mR(
double **A,
double **invA
double **ID = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **AID;
int r = A[R_SIZE][C0];
 r--;
 AID = i_Abr_Ac_bc_mR(r,r,r);
 eye_mR(ID);
 c_A_b_Ab_mR(A,ID,AID);
 invgj_pivot_mR(AID);
 sort_c_mR(AID);
 xx_sort_r_mR(AID);
 c_Inv_A_mR(AID,invA);
 f_mR(AID);
 f_mR(ID);
return(invA);
/* ------------------------------------ */
void fun(int r)
double **A = r_mR( i_mR(r,r), 99.);
double **Inv = i_mR(r,r);
double **AInv = i_mR(r,r);
 clrscrn();
 XX_invgj_mR(A,Inv);
 printf(" Copy/Past into the octave window.\n\n");
 printf("format short e\n");
 p_Octave_mR(A,"A",P0);
 printf(" inv(A)");
 pE_mR(Inv,S12,P4,C6);
 printf(" A * inv(A)");
 mul_mR(A,Inv,AInv);
 p_mR(AInv,S12,P4,C6);
 f_mR(AInv); 
 f_mR(Inv);
 f_mR(A);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(C2)+C2);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Nous allons voir une nouvelle fonction, sort_r_mR(); que nous appellerons xx_sort_r_mR();

Exemple de sortie écran :
 Copy/Past into the octave window.
format short e
 A=[
-75,+52,-57;
+30,+22,+20;
-91,-45,-57]
 inv(A)
 +2.1673e-02 -3.3850e-01 -1.4044e-01 
 +6.7344e-03 +5.5834e-02 +1.2857e-02 
 -3.9917e-02 +4.9633e-01 +1.9652e-01 
 A * inv(A)
 +1.0000 -0.0000 +0.0000 
 -0.0000 +1.0000 +0.0000 
 +0.0000 -0.0000 +1.0000 
 Press return to continue
 Press X to stop

Mathc matrices/c09a11
Étude du code
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : inv11.c */
/* ------------------------------------ */
double **xx_sort_r_mR(
double **Ab
double pivot;
int c;
int r;
int r_pivot = R1;
clrscrn(); 
printf(" Ab");
pE_mR(Ab,S12,P4,C6);
stop();
clrscrn(); 
 for ( c=C1; c<Ab[C_SIZE_A][C0]; c++)
 r = r_pivot;
 pivot = 0.;
 while( (pivot<ERROR_E) && r<Ab[R_SIZE][C0] )
 pivot = fabs( Ab[r][c] );
clrscrn(); 
printf("/* --------- DEBUG 1 ---------- */\n\n"); 
printf(" Ab : pivot[%d][%d] = %f ",r,c,pivot);
p_mR(Ab,S8,P4,C8);
 if(pivot>ERROR_E) 
 swapR_mR(Ab, r, r_pivot);
 r_pivot++;
printf(" Ab");
p_mR(Ab,S8,P4,C8);
stop();
clrscrn(); 
/* --------- DEBUG 1 ---------- */
 r++;
 return(Ab);
/* ------------------------------------ */
double **XX_invgj_mR(
double **A,
double **invA
double **ID = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **AID;
int r = A[R_SIZE][C0];
 r--;
 AID = i_Abr_Ac_bc_mR(r,r,r);
 eye_mR(ID);
 c_A_b_Ab_mR(A,ID,AID);
 invgj_pivot_mR(AID);
 sort_c_mR(AID);
 xx_sort_r_mR(AID);
 c_Inv_A_mR(AID,invA);
 f_mR(AID);
 f_mR(ID);
return(invA);
/* ------------------------------------ */
void fun(int r)
double **A = r_mR( i_mR(r,r), 99.);
double **Inv = i_mR(r,r);
double **AInv = i_mR(r,r);
 clrscrn();
 XX_invgj_mR(A,Inv);
 printf(" Copy/Past into the octave window.\n\n");
 printf("format short e\n");
 p_Octave_mR(A,"A",P0);
 printf(" inv(A)");
 pE_mR(Inv,S12,P4,C6);
 printf(" A * inv(A)");
 mul_mR(A,Inv,AInv);
 p_mR(AInv,S12,P4,C6);
 f_mR(AInv); 
 f_mR(Inv);
 f_mR(A);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(C4);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 On commence par regarder le premier pivot (R1xC1), si il est nulle on descend dans la colonne pour trouver un pivot non nul. Lorsque le pivot non nul est trouver on échange la ligne avec la ligne du pivot. Puis on passe à la colonne suivante (R2xC2).