Mathc matrices/c17d
Installer et compiler ces fichiers dans votre répertoire de travail.
gj_r4.c |
---|
/* ------------------------------------ */
/* Save as : gj_r4.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **xx_GJ_TPfreeV_mR(
double **Ab,
double **new_Ab)
{
int r;
c_mR(Ab,new_Ab);
clrscrn();
printf(" ---------------DEBUG 1 ------------ \n");
printf(" new_Ab : put the zero rows");
p_mR(new_Ab,S8,P4,C8);
put_freeV_TP_mR(new_Ab,Ab[R_SIZE][C0]);
printf(" new_Ab : put_freeV_TP_mR()");
p_mR(new_Ab,S8,P4,C8);
stop();
clrscrn();
printf(" ---------------DEBUG 2 ------------ \n");
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(new_Ab,"new_Ab",P8);
printf("\n rref(new_Ab,.00000000001)\n\n");
stop();
clrscrn();
printf(" -- VERIFY THE RESULT INTO OCTAVE --\n");
r = rsize_R(new_Ab);
while(r>R1)
zero_below_pivot_gj1Ab_mR(new_Ab,r--);
return(new_Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r, int c)
{
double **A = i_mR(r,c);
double **b = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,c,C1);
double **new_Ab = i_Abr_Ac_bc_mR(csize_A_R(Ab),
csize_A_R(Ab),
csize_R(A)-rsize_R(A) + C1);
r_mR(A,999.);
r_mR(b,999.);
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C7);
printf(" b :");
p_mR(b,S8,P0,C7);
printf(" Ab :");
c_A_b_Ab_mR(A,b,Ab);
p_mR(Ab,S8,P0,C7);
stop();
clrscrn();
GJ_TP_mR(Ab);
printf(" Ab :");
p_mR(Ab,S10,P4,C7);
stop();
clrscrn();
xx_GJ_TPfreeV_mR(Ab,new_Ab);
printf(" new_Ab :");
p_mR(new_Ab,S10,P4,C7);
f_mR(new_Ab);
f_mR(Ab);
f_mR(b);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R3, C5);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vérifions le résultat avec octave Exemple de sortie écran :
------------------------------------------
A :
-468 +595 -781 -833 -270
-55 -978 -879 -525 -243
-52 -817 -799 -808 -42
b :
-934
-680
-639
Ab :
-468 +595 -781 -833 -270 -934
-55 -978 -879 -525 -243 -680
-52 -817 -799 -808 -42 -639
Press return to continue.
------------------------------------------
Ab :
+1.0000 +0.0000 -0.0000 -16.8104 +9.7578 -0.2510
+0.0000 +1.0000 -0.0000 -5.0632 +2.7567 -0.2972
+0.0000 -0.0000 +1.0000 +7.2826 -3.4013 +1.1199
Press return to continue.
---------------DEBUG 1 ------------
new_Ab : put the zero rows
+1.0000 +0.0000 -0.0000 -16.8104 +9.7578 -0.2510 +0.0000 +0.0000
+0.0000 +1.0000 -0.0000 -5.0632 +2.7567 -0.2972 +0.0000 +0.0000
+0.0000 -0.0000 +1.0000 +7.2826 -3.4013 +1.1199 +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
new_Ab : put_freeV_TP_mR()
+1.0000 +0.0000 -0.0000 -16.8104 +9.7578 -0.2510 +0.0000 +0.0000
+0.0000 +1.0000 -0.0000 -5.0632 +2.7567 -0.2972 +0.0000 +0.0000
+0.0000 -0.0000 +1.0000 +7.2826 -3.4013 +1.1199 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +1.0000
Press return to continue.
---------------DEBUG 2 ------------
Copy/Past into the octave window.
new_Ab=[
+1.00000000,+0.00000000,-0.00000000,-16.81043896,+9.75782546,-0.25101204,+0.00000000,+0.00000000;
+0.00000000,+1.00000000,-0.00000000,-5.06319322,+2.75671307,-0.29715283,+0.00000000,+0.00000000;
+0.00000000,-0.00000000,+1.00000000,+7.28256782,-3.40130351,+1.11993303,+0.00000000,+0.00000000;
+0.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000;
+0.00000000,+0.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000,+0.00000000,+1.00000000]
rref(new_Ab,.00000000001)
Press return to continue.
-- VERIFY THE RESULT INTO OCTAVE --
new_Ab :
+1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -0.2510 +16.8104
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.2972 +5.0632
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +1.1199 -7.2826
+0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +1.0000
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000
-9.7578
-2.7567
+3.4013
+0.0000
+1.0000
Press return to continue
Press X to stop