Mathc matrices/a114
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R2
#define CA C2
#define Cb C1
/* ------------------------------------ */
int main(void)
{
double ab[RA*(CA+C1)]={
-3, -9, +12,
+2, +6, -8,
};
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+C1);
double **b_free = i_mR(rsize_R(Ab_free),csize_b_R(Ab_free));
int r;
clrscrn();
printf(" A :");
p_mR(A,S6,P1,C10);
printf(" b :");
p_mR(b,S6,P1,C10);
printf(" Ab :");
p_mR(Ab,S6,P1,C10);
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P1);
printf("\n rref(Ab,.00000000001)\n\n");
printf(" Ab : gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab,S6,P1,C10);
stop();
clrscrn();
put_zeroR_mR(Ab,Ab_free);
printf(" Ab_free : put_zeroR_mR(Ab,Ab_free);");
p_mR(Ab_free,S6,P1,C10);
put_freeV_mR(Ab_free);
printf(" Ab_free : put_freeV_mR(Ab_free);");
p_mR(Ab_free,S6,P1,C10);
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab_free,"Ab_free",P1);
printf("\n rref(Ab_free,.00000000001)\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,S6,P1,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 :
-3.0 -9.0
+2.0 +6.0
b :
+12.0
-8.0
Ab :
-3.0 -9.0 +12.0
+2.0 +6.0 -8.0
Press return to continue.
---------------------
Copy/Past into the octave window.
Ab=[
-3.0,-9.0,+12.0;
+2.0,+6.0,-8.0]
rref(Ab,.00000000001)
Ab : gj_PP_mR(Ab,NO) :
+1.0 +3.0 -4.0
+0.0 +0.0 +0.0
Press return to continue.
---------------------
Ab_free : put_zeroR_mR(Ab,Ab_free);
+1.0 +3.0 -4.0 +0.0
+0.0 +0.0 +0.0 +0.0
Ab_free : put_freeV_mR(Ab_free);
+1.0 +3.0 -4.0 +0.0
+0.0 +1.0 +0.0 +1.0
Press return to continue.
---------------------
Copy/Past into the octave window.
Ab_free=[
+1.0,+3.0,-4.0,+0.0;
+0.0,+1.0,+0.0,+1.0]
rref(Ab_free,.00000000001)
Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);
+1.0 +0.0 -4.0 -3.0
+0.0 +1.0 +0.0 +1.0
Press return to continue.
---------------------
b_free :
-4.0000 -3.0000
+0.0000 +1.0000
b_free : free variables
x1 = -4.0000 -3.0000*w
x2 = +0.0000 +1.0000*w
Press return to continue.