Mathc matrices/c22r
Application ou QR décomposition 
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00a.c */
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);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
double **Q_T = i_mR(r,r);
double **invR = i_mR(r,r);
double **invR_Q_T = i_mR(r,r);
double **x = i_mR(r,C1); // x invR * Q_T * b
 do
 r_mR(A,999.);
 printf(".");
 }while(!det_R(A));
 clrscrn();
 printf(" A :");
 p_mR(A,S8,P0,C7);
 printf(" b :");
 r_mR(b,999.);
 p_mR(b,S8,P0,C7);
 printf(" Ab :");
 c_A_b_Ab_mR(A,b,Ab);
 p_mR(Ab,S8,P0,C7);
 stop();
 clrscrn();
 QR_uv_mR(A,Q,R); 
 printf(" Q :");
 p_mR(Q,S3,P4,C6); 
 printf(" R :");
 p_mR(R,S10,P4,C6);
 stop();
 clrscrn();
 transpose_mR(Q,Q_T); 
 printf(" Q_T :");
 pE_mR(Q_T,S3,P4,C6); 
 inv_mR(R,invR); 
 printf(" invR :");
 pE_mR(invR,S10,P4,C6);
 stop();
 clrscrn();
 printf(" Copy/Past into the octave window.\n\n");
 p_Octave_mR(Ab,"Ab",P0);
 printf(" rref(Ab.00000000001)\n\n");
 stop();
 clrscrn();
 printf(" gj_TP_mR(Ab) :");
 gj_TP_mR(Ab);
 p_mR(Ab,S10,P4,C7);
 mul_mR(invR,Q_T,invR_Q_T);
 mul_mR(invR_Q_T,b,x);
 printf(" x = invR * Q_T * b :");
 p_mR(x,S10,P4,C6);
 f_mR(A);
 f_mR(b);
 f_mR(Ab);
 f_mR(Q);
 f_mR(Q_T);
 f_mR(R);
 f_mR(invR); 
 f_mR(invR_Q_T); 
 f_mR(x); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(RC5)+R1);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 On obtient le même résultat qu'avec la méthode de gauss jordan

Exemple de sortie écran :
 A :
 +303 +668 +458 +849 +842 
 +160 -201 +648 -117 -704 
 +531 +986 -696 +611 -443 
 -153 -265 -901 -208 -589 
 -306 +39 +119 -82 +364 
 b :
 -393 
 +296 
 +381 
 -64 
 -477 
 Ab :
 +303 +668 +458 +849 +842 -393 
 +160 -201 +648 -117 -704 +296 
 +531 +986 -696 +611 -443 +381 
 -153 -265 -901 -208 -589 -64 
 -306 +39 +119 -82 +364 -477 
 Press return to continue. 
 -----------------------------------
 Q :
+0.4216 +0.3386 +0.4293 +0.7050 -0.1621 
+0.2226 -0.5892 +0.3447 -0.2125 -0.6628 
+0.7389 +0.3372 -0.4144 -0.3846 -0.1437 
-0.2129 -0.0707 -0.6873 +0.4615 -0.5141 
-0.4258 +0.6477 +0.2299 -0.3112 -0.4994 
 R :
 +718.6202 +1005.2890 -35.7393 +862.6031 -158.6568 
 +0.0000 +721.0832 -320.6643 +524.0055 +827.8365 
 +0.0000 -0.0000 +1354.9698 +195.0440 +790.8400 
 +0.0000 +0.0000 -0.0000 +317.9480 +528.4995 
 -0.0000 +0.0000 +0.0000 +0.0000 +514.8021 
 Press return to continue. 
 -----------------------------------
 Q_T :
+4.2164e-01 +2.2265e-01 +7.3892e-01 -2.1291e-01 -4.2582e-01 
+3.3856e-01 -5.8915e-01 +3.3724e-01 -7.0680e-02 +6.4773e-01 
+4.2926e-01 +3.4469e-01 -4.1436e-01 -6.8730e-01 +2.2988e-01 
+7.0502e-01 -2.1251e-01 -3.8461e-01 +4.6154e-01 -3.1119e-01 
-1.6211e-01 -6.6284e-01 -1.4371e-01 -5.1407e-01 -4.9944e-01 
 invR :
+1.3916e-03 -1.9400e-03 -4.2242e-04 -3.1889e-04 +4.5248e-03 
+0.0000e+00 +1.3868e-03 +3.2820e-04 -2.4869e-03 -1.8118e-04 
+0.0000e+00 -0.0000e+00 +7.3802e-04 -4.5274e-04 -6.6897e-04 
+0.0000e+00 -0.0000e+00 +0.0000e+00 +3.1452e-03 -3.2289e-03 
-0.0000e+00 +0.0000e+00 -0.0000e+00 -0.0000e+00 +1.9425e-03 
 Press return to continue. 
 -----------------------------------
 Copy/Past into the octave window.
 Ab=[
+303,+668,+458,+849,+842,-393;
+160,-201,+648,-117,-704,+296;
+531,+986,-696,+611,-443,+381;
-153,-265,-901,-208,-589,-64;
-306,+39,+119,-82,+364,-477]
 rref(Ab.00000000001)
 Press return to continue. 
 -----------------------------------
 gj_TP_mR(Ab) :
 +1.0000 -0.0000 -0.0000 +0.0000 -0.0000 +2.1117 
 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.1334 
 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.1039 
 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 -1.4271 
 -0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.1630 
 x = invR * Q_T * b :
 +2.1117 
 +0.1334 
 -0.1039 
 -1.4271 
 +0.1630 
 Press return to continue
 Press X to stop

Mathc matrices/c22m
Application ou QR décomposition 
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00b.c */
void fun(int r,int rn)
double **A = i_mR(r+rn,r);
double **b = i_mR(r+rn,C1);
double **Ab = i_Abr_Ac_bc_mR(r+rn,r,C1);
double **Q = i_mR(r+rn,r);
double **R = i_mR(r,r);
double **invR = i_mR(r,r);
double **Q_T = i_mR(r,r+rn);
double **invR_Q_T = i_mR(r,r+rn);
double **x = i_mR(r,C1); // x invR * Q_T * b
 clrscrn();
 printf(" Find the unique Least Squares Solution :\n\n");
 printf(" A :");
 p_mR(r_mR(A,999.),S5,P0,C7);
 printf(" b :");
 p_mR(r_mR(b,999.),S5,P0,C7);
 printf(" Ab :");
 c_A_b_Ab_mR(A,b,Ab);
 p_mR(Ab,S5,P0,C7);
 stop();
 clrscrn();
 QR_uv_mR(A,Q,R); 
 printf(" Q :");
 p_mR(Q,S3,P4,C6); 
 printf(" R :");
 p_mR(R,S10,P4,C6);
 stop();
 clrscrn();
 transpose_mR(Q,Q_T); 
 printf(" Q_T :");
 pE_mR(Q_T,S3,P4,C6); 
 inv_mR(R,invR); 
 printf(" invR :");
 pE_mR(invR,S10,P4,C6);
 stop();
 clrscrn();
 printf(" Solving this system yields a unique\n"
 " least squares solution, namely \n\n");
 mul_mR(invR,Q_T,invR_Q_T);
 mul_mR(invR_Q_T,b,x);
 printf(" x = invR * Q_T * b :");
 p_mR(x,S10,P4,C6);
 f_mR(A);
 f_mR(b);
 f_mR(Ab);
 f_mR(Q);
 f_mR(Q_T);
 f_mR(R);
 f_mR(invR); 
 f_mR(invR_Q_T); 
 f_mR(x); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R1,rp_I(C3));
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Ici le nombre de lignes doit être supérieurs aux nombres de colonnes. La fonction gaussjordan ne fonctionne pas dans cette situation.

Exemple de sortie écran :
 Find the unique Least Squares Solution :
 A :
 -267 +417 
 -741 -89 
 +557 -127 
 +798 +239 
 -130 -696 
 b :
 -763 
 -784 
 +513 
 -861 
 +13 
 Ab :
 -267 +417 -763 
 -741 -89 -784 
 +557 -127 +513 
 +798 +239 -861 
 -130 -696 +13 
 Press return to continue. 
 -----------------------------------
 Q :
-0.2121 +0.5234 
-0.5887 -0.0139 
+0.4425 -0.2177 
+0.6340 +0.1834 
-0.1033 -0.8030 
 R :
+1258.6989 +131.1457 
 -0.0000 +849.8687 
 Press return to continue. 
 -----------------------------------
 Q_T :
-2.1212e-01 -5.8870e-01 +4.4252e-01 +6.3399e-01 -1.0328e-01 
+5.2340e-01 -1.3878e-02 -2.1772e-01 +1.8339e-01 -8.0301e-01 
 invR :
+7.9447e-04 -1.2260e-04 
-0.0000e+00 +1.1767e-03 
 Press return to continue. 
 -----------------------------------
 Solving this system yields a unique
 least squares solution, namely 
 x = invR * Q_T * b :
 +0.3228 
 -0.7866 
 Press return to continue
 Press X to stop

Mathc matrices/c22t
Application ou QR décomposition 
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00c.c */
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
double ab[RA*(CA+Cb)]={
 1, -1, 4,
 3, 2, 1,
-2, 4, 3
double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(RA,CA,Cb));
double **A = c_Ab_A_mR(Ab,i_mR(RA,CA));
double **b = c_Ab_b_mR(Ab,i_mR(RA,Cb));
double **Q = i_mR(RA,CA);
double **R = i_mR(CA,CA);
double **invR = i_mR(CA,CA);
double **Q_T = i_mR(CA,RA);
double **invR_Q_T = i_mR(CA,RA);
double **x = i_mR(CA,Cb); // x invR * Q_T * b
 clrscrn();
 printf("Unique Least Squares Solution :\n\n");
 printf(" A :");
 p_mR(A,S5,P1,C7);
 printf(" b :");
 p_mR(b,S5,P1,C7);
 printf(" Ab :");
 p_mR(Ab,S5,P1,C7);
 stop();
 clrscrn();
 QR_uv_mR(A,Q,R); 
 printf(" Q :");
 p_mR(Q,S3,P4,C6); 
 printf(" R :");
 p_mR(R,S10,P4,C6);
 stop();
 clrscrn();
 transpose_mR(Q,Q_T); 
 printf(" Q_T :");
 pE_mR(Q_T,S3,P4,C6); 
 inv_mR(R,invR); 
 printf(" invR :");
 pE_mR(invR,S10,P4,C6);
 stop();
 clrscrn();
 printf(" Solving this system yields a unique\n"
 " least squares solution, namely \n\n");
 mul_mR(invR,Q_T,invR_Q_T);
 mul_mR(invR_Q_T,b,x);
 printf(" x = invR * Q_T * b :");
 p_mR(x,S10,P4,C6);
 stop();
 f_mR(A);
 f_mR(b);
 f_mR(Ab);
 f_mR(Q);
 f_mR(Q_T);
 f_mR(R);
 f_mR(invR); 
 f_mR(invR_Q_T); 
 f_mR(x); 
/* ------------------------------------ */
int main(void)