Mathc matrices/c17e
Apparence
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
/* ------------------------------------ */
int main(void)
{
double ab[RA*(CA+Cb)]={
+964, -689, +474, +948, -159,
+640, -693, -937, +656, +718,
-981, -337, -287, +420, +812,
-807, -123, +404, -177, -105
};
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 **x = i_mR(RA,Cb);
double **Ax = i_mR(RA,Cb);
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C7);
printf(" b :");
p_mR(b,S8,P0,C7);
printf(" Ab :");
p_mR(Ab,S8,P0,C7);
getchar();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P0);
printf("\n rref(Ab,.00000000001)\n\n");
printf(" gj_PP_mR(Ab,YES) :");
gj_PP_mR(Ab,YES);
p_mR(Ab,S10,P4,C7);
//printf(" gj_TP_mR(Ab) :");
//gj_TP_mR(Ab);
//p_mR(Ab,S10,P4,C7);
stop();
clrscrn();
printf(" b :");
p_mR(b,S10,P4,C7);
printf(" A * x = b :");
c_c_mR(Ab,CA+C1,x,C1);
mul_mR(A,x,Ax);
p_mR(Ax,S10,P4,C7);
stop();
f_mR(Ab);
f_mR(b);
f_mR(A);
f_mR(x);
f_mR(Ax);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Ce système fonctionne avec le Partial Pivoting et le Total Pivoting :
Exemple de sortie écran :
A :
+964 -689 +474 +948
+640 -693 -937 +656
-981 -337 -287 +420
-807 -123 +404 -177
b :
-159
+718
+812
-105
Ab :
+964 -689 +474 +948 -159
+640 -693 -937 +656 +718
-981 -337 -287 +420 +812
-807 -123 +404 -177 -105
Copy/Past into the octave window.
Ab=[
+964,-689,+474,+948,-159;
+640,-693,-937,+656,+718;
-981,-337,-287,+420,+812;
-807,-123,+404,-177,-105]
rref(Ab,.00000000001)
gj_PP_mR(Ab,YES) :
+1.0000 +0.0000 +0.0000 +0.0000 -0.3916
+0.0000 +1.0000 +0.0000 +0.0000 +0.1846
+0.0000 +0.0000 +1.0000 +0.0000 -0.6777
-0.0000 -0.0000 -0.0000 +1.0000 +0.7036
Press return to continue.
b :
-159.0000
+718.0000
+812.0000
-105.0000
A * x = b :
-159.0000
+718.0000
+812.0000
-105.0000
Press return to continue.