Mathc matrices/e1608
Installer et compiler ces fichiers dans votre répertoire de travail.
gj08.c |
---|
/* ------------------------------------ */
/* Save as : gj08.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>R2)
{
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)
{
printf(" Ab : pivot[%d][[%d] ",r,c);
p_mR(Ab,S8,P4,C8);
zero_below_pivot_gj3Ab_mR(Ab,r,c);
printf(" Ab : pivot[%d][[%d]"
" The work of zero_below_pivot_gj1Ab_mR();",r,c);
p_mR(Ab,S8,P4,C8);
stop();
clrscrn();
}
}
}
/* ------------------------------------ */
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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Cette fois ci on met des zéros au dessus des pivots.
Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
Ab=[
-807,-885,+368,+990,-643,+400;
-801,-229,-989,-441,-287,-243;
+52,-129,-983,-405,-223,-969;
-785,-561,+380,-969,-653,-633;
+996,+38,-905,+56,-815,+406]
rref(Ab,.00000000001)
Press return to continue.
Ab : pivot[5][[5]
+1.0000 +0.0382 -0.9086 +0.0562 -0.8183 +0.4076
+0.0000 +1.0000 +0.4276 -1.2121 +1.5258 -0.8534
+0.0000 -0.0000 +1.0000 +0.3900 +0.3920 +0.0526
+0.0000 -0.0000 -0.0000 +1.0000 +0.2904 +0.4981
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.0382 -0.9086 +0.0562 -0.0000 -1.3930
-0.0000 +1.0000 +0.4276 -1.2121 +0.0000 +2.5042
-0.0000 -0.0000 +1.0000 +0.3900 +0.0000 +0.9151
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Press return to continue.
Ab : pivot[4][[4]
+1.0000 +0.0382 -0.9086 +0.0562 -0.0000 -1.3930
-0.0000 +1.0000 +0.4276 -1.2121 +0.0000 +2.5042
-0.0000 -0.0000 +1.0000 +0.3900 +0.0000 +0.9151
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.0382 -0.9086 +0.0000 -0.0000 -1.4569
-0.0000 +1.0000 +0.4276 -0.0000 +0.0000 +3.8824
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.4716
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Press return to continue.
Ab : pivot[3][[3]
+1.0000 +0.0382 -0.9086 +0.0000 -0.0000 -1.4569
-0.0000 +1.0000 +0.4276 -0.0000 +0.0000 +3.8824
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.4716
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.0382 +0.0000 +0.0000 -0.0000 -1.0284
-0.0000 +1.0000 +0.0000 -0.0000 +0.0000 +3.6807
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.4716
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Press return to continue.
Ab : pivot[2][[2]
+1.0000 +0.0382 +0.0000 +0.0000 -0.0000 -1.0284
-0.0000 +1.0000 +0.0000 -0.0000 +0.0000 +3.6807
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.4716
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Ab : The work of zero_below_pivot_gj1Ab_mR();
+1.0000 +0.0000 +0.0000 +0.0000 -0.0000 -1.1688
-0.0000 +1.0000 +0.0000 -0.0000 +0.0000 +3.6807
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.4716
-0.0000 -0.0000 -0.0000 +1.0000 +0.0000 +1.1371
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000 -2.2005
Press return to continue.
gj_PP_mR(Ab,YES) :
+1.00000 +0.00000 +0.00000 +0.00000 -0.00000 -1.16882
-0.00000 +1.00000 +0.00000 -0.00000 +0.00000 +3.68071
-0.00000 +0.00000 +1.00000 +0.00000 +0.00000 +0.47164
-0.00000 -0.00000 -0.00000 +1.00000 +0.00000 +1.13706
+0.00000 +0.00000 +0.00000 -0.00000 +1.00000 -2.20053
Press return to continue
Press X to stop