Mathc matrices/e1508
Installer et compiler ces fichiers dans votre répertoire de travail.
gj08.c |
---|
/* ------------------------------------ */
/* Save as : gj08.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **xx_gj1_T_mR(
double **Ab
)
{
int r= R1;
while(r<Ab[R_SIZE][C0])
{
if(fabs(pivotbest_gj1Ab_mR(Ab,r))>ERROR_E)
zero_under_pivot_gj1Ab_mR(Ab,r);
r++;
}
while(r>R2)
{
printf(" Ab : pivot[%d][[%d] \n",r-R1,r-R1); /* See : --r */
p_mR(Ab,S8,P4,C8);
zero_below_pivot_gj1Ab_mR(Ab,--r);
printf(" Ab : pivot[%d][[%d]"
" The work of zero_below_pivot_gj1Ab_mR();\n",
r,r);
p_mR(Ab,S8,P4,C8);
stop();
clrscrn();
}
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **XX_gj_TP_mR(
double **Ab
)
{
xx_gj1_T_mR(Ab);
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(R5);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Cette fois ci on met des zéros au dessus des pivots.
Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
Ab=[
-943,-389,+384,-897,+264,+938;
+938,+794,+536,-605,-917,+342;
+538,-905,-235,-921,-971,+296;
+20,+400,+758,-543,-883,+820;
-735,+514,-669,+966,-539,-499]
rref(Ab,.00000000001)
Press return to continue.
Ab : pivot[5][[5]
+1.0000 +0.9320 +0.9485 -0.5541 +0.2420 -0.3048
+0.0000 +1.0000 +0.1606 +0.2608 +0.4597 +0.0379
+0.0000 +0.0000 +1.0000 -0.9883 -0.7654 -0.5341
-0.0000 -0.0000 -0.0000 +1.0000 +0.1130 -0.2909
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.9320 +0.9485 -0.5541 +0.0000 -0.4579
+0.0000 +1.0000 +0.1606 +0.2608 +0.0000 -0.2528
+0.0000 +0.0000 +1.0000 -0.9883 +0.0000 -0.0501
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Press return to continue.
Ab : pivot[4][[4]
+1.0000 +0.9320 +0.9485 -0.5541 +0.0000 -0.4579
+0.0000 +1.0000 +0.1606 +0.2608 +0.0000 -0.2528
+0.0000 +0.0000 +1.0000 -0.9883 +0.0000 -0.0501
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.9320 +0.9485 +0.0000 +0.0000 -0.6587
+0.0000 +1.0000 +0.1606 +0.0000 +0.0000 -0.1583
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4083
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Press return to continue.
Ab : pivot[3][[3]
+1.0000 +0.9320 +0.9485 +0.0000 +0.0000 -0.6587
+0.0000 +1.0000 +0.1606 +0.0000 +0.0000 -0.1583
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4083
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.9320 +0.0000 +0.0000 +0.0000 -0.2714
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.0927
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4083
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Press return to continue.
Ab : pivot[2][[2]
+1.0000 +0.9320 +0.0000 +0.0000 +0.0000 -0.2714
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.0927
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4083
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -0.1850
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.0927
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4083
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 -0.3624
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.6323
Press return to continue.
gj_TP_mR(Ab) :
+1.00000 -0.00000 +0.00000 -0.00000 -0.00000 -0.36240
+0.00000 +1.00000 +0.00000 +0.00000 +0.00000 -0.09275
+0.00000 +0.00000 +1.00000 +0.00000 +0.00000 +0.63234
+0.00000 +0.00000 +0.00000 +1.00000 +0.00000 -0.40825
+0.00000 +0.00000 +0.00000 +0.00000 +1.00000 -0.18500
Press return to continue
Press X to stop