Mathc matrices/a118
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R4
#define CA C4
#define Cb C1
#define CFV C2
/* ------------------------------------ */
int main(void)
{
double ab[RA*(CA+C1)]={
-1888.0, +674.0, -1554.0, -262.0, -1184.0,
+2832.0, -1011.0, +2331.0, +393.0, +1776.0,
-944.0, +337.0, -777.0, -131.0, -592.0,
+69.0, +777.0, -245.0, -51.0, +974.0
};
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 **Ab_free = i_Abr_Ac_bc_mR(csize_A_R(Ab),csize_A_R(Ab),Cb+CFV);
double **b_free = i_mR(rsize_R(Ab_free),csize_b_R(Ab_free));
int r;
clrscrn();
printf(" A :");
p_mR(A,S10,P4,C10);
printf(" b :");
p_mR(b,S10,P4,C10);
printf(" Ab :");
P_mR(Ab,S10,P4,C10);
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P4);
printf("\n rref(Ab,.00000001)\n\n");
printf(" Ab : gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab,S10,P4,C10);
stop();
clrscrn();
put_zeroR_mR(Ab,Ab_free);
printf(" Ab_free : put_zeroR_mR(Ab,Ab_free);");
p_mR(Ab_free,S10,P4,C10);
put_freeV_mR(Ab_free);
printf(" Ab_free : put_freeV_mR(Ab_free);");
p_mR(Ab_free,S10,P4,C10);
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab_free,"Ab_free",P4);
printf("\n rref(Ab_free,.00000001)\n\n");
r = rsize_R(Ab_free);
while(r>R1)
zero_below_pivot_gj1Ab_mR(Ab_free,r--);
printf(" Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);");
p_mR(Ab_free,S10,P4,C10);
stop();
clrscrn();
c_Ab_b_mR(Ab_free,b_free);
printf(" b_free :");
p_mR(b_free,S10,P4,C7);
printf(" b_free : free variables");
p_freeV(b_free,S8,P4);
stop();
f_mR(Ab);
f_mR(Ab_free);
f_mR(b_free);
f_mR(b);
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
---------------------
A :
-1888.0000 +674.0000 -1554.0000 -262.0000
+2832.0000 -1011.0000 +2331.0000 +393.0000
-944.0000 +337.0000 -777.0000 -131.0000
+69.0000 +777.0000 -245.0000 -51.0000
b :
-1184.0000
+1776.0000
-592.0000
+974.0000
Ab :
-1888.0000, +674.0000, -1554.0000, -262.0000, -1184.0000,
+2832.0000, -1011.0000, +2331.0000, +393.0000, +1776.0000,
-944.0000, +337.0000, -777.0000, -131.0000, -592.0000,
+69.0000, +777.0000, -245.0000, -51.0000, +974.0000
Press return to continue.
---------------------
Copy/Past into the octave window.
Ab=[
-1888.0000,+674.0000,-1554.0000,-262.0000,-1184.0000;
+2832.0000,-1011.0000,+2331.0000,+393.0000,+1776.0000;
-944.0000,+337.0000,-777.0000,-131.0000,-592.0000;
+69.0000,+777.0000,-245.0000,-51.0000,+974.0000]
rref(Ab,.00000001)
Ab : gj_PP_mR(Ab,NO) :
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271
+0.0000 +1.0000 -0.3765 -0.0756 +1.1610
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000
Press return to continue.
---------------------
Ab_free : put_zeroR_mR(Ab,Ab_free);
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271 +0.0000 +0.0000
+0.0000 +1.0000 -0.3765 -0.0756 +1.1610 +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
Ab_free : put_freeV_mR(Ab_free);
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271 +0.0000 +0.0000
+0.0000 +1.0000 -0.3765 -0.0756 +1.1610 +0.0000 +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 +1.0000
Press return to continue.
---------------------
Copy/Past into the octave window.
Ab_free=[
+1.0000,-0.3570,+0.8231,+0.1388,+0.6271,+0.0000,+0.0000;
+0.0000,+1.0000,-0.3765,-0.0756,+1.1610,+0.0000,+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,+1.0000]
rref(Ab_free,.00000001)
Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);
+1.0000 +0.0000 +0.0000 +0.0000 +1.0416 -0.6887 -0.1118
+0.0000 +1.0000 +0.0000 +0.0000 +1.1610 +0.3765 +0.0756
+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 +1.0000
Press return to continue.
---------------------
b_free :
+1.0416 -0.6887 -0.1118
+1.1610 +0.3765 +0.0756
+0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +1.0000
b_free : free variables
x1 = +1.0416 -0.6887*u -0.1118*v
x2 = +1.1610 +0.3765*u +0.0756*v
x3 = +0.0000 +1.0000*u +0.0000*v
x4 = +0.0000 +0.0000*u +1.0000*v
Press return to continue.