Mathc matrices/c21x
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double ab[R4*C7]={
1, -3, 4, -2, 5, +4, 0,
2, -6, 9, -1, 8, 2, 0,
2, -6, 9, -1, 9, 7, 0,
-1, 3, -4, 2, -5, -4, 0,
};
double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(R4,C6,C1));
double **A = c_Ab_A_mR(Ab,i_mR(R4,C6));
double **b = c_Ab_b_mR(Ab,i_mR(R4,C1));
double **B = i_mR(R4,C3);
double **BT = i_mR(C3,R4);
double **BTb = i_Abr_Ac_bc_mR(C3,R4,C1);
clrscrn();
printf("Basis for a Column Space by Row Reduction :\n\n");
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(" The leading 1’s of Ab give the position \n"
" of the columns of A which form a basis \n"
" for the column space of A \n\n"
" A :");
p_mR(A,S7,P3,C10);
printf(" gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab,S7,P3,C10);
c_c_mR(A,C1,B,C1);
c_c_mR(A,C3,B,C2);
c_c_mR(A,C5,B,C3);
printf(" B : A basis for the column space of A");
p_mR(B,S7,P3,C10);
stop();
clrscrn();
printf(" Check if the columns of B are linearly independent\n\n"
" BT :");
p_mR(transpose_mR(B,BT), S4,P0, C8);
printf(" BTb :");
p_mR(c_mR(BT,BTb), S4,P0, C8);
printf(" gj_PP_FreeV_mZ(BTb) :");
p_mR(gj_PP_mR(BTb,NO), S8,P4, C8);
stop();
f_mR(Ab);
f_mR(b);
f_mR(A);
f_mR(B);
f_mR(BT);
f_mR(BTb);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La position des pivots de Ab donne la position des colonnes de A qui forment une base pour l'espace colonnes de A.
Exemple de sortie écran :
------------------------------------
Basis for a Column Space by Row Reduction :
A :
+1.0 -3.0 +4.0 -2.0 +5.0 +4.0
+2.0 -6.0 +9.0 -1.0 +8.0 +2.0
+2.0 -6.0 +9.0 -1.0 +9.0 +7.0
-1.0 +3.0 -4.0 +2.0 -5.0 -4.0
b :
+0.0
+0.0
+0.0
+0.0
Ab :
+1.0 -3.0 +4.0 -2.0 +5.0 +4.0 +0.0
+2.0 -6.0 +9.0 -1.0 +8.0 +2.0 +0.0
+2.0 -6.0 +9.0 -1.0 +9.0 +7.0 +0.0
-1.0 +3.0 -4.0 +2.0 -5.0 -4.0 +0.0
Press return to continue.
------------------------------------
The leading 1’s of Ab give the position
of the columns of A which form a basis
for the column space of A
A :
+1.000 -3.000 +4.000 -2.000 +5.000 +4.000
+2.000 -6.000 +9.000 -1.000 +8.000 +2.000
+2.000 -6.000 +9.000 -1.000 +9.000 +7.000
-1.000 +3.000 -4.000 +2.000 -5.000 -4.000
gj_PP_mR(Ab,NO) :
+1.000 -3.000 +4.500 -0.500 +4.000 +1.000 +0.000
-0.000 -0.000 +1.000 +3.000 -2.000 -6.000 -0.000
+0.000 +0.000 +0.000 +0.000 +1.000 +5.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000
B : A basis for the column space of A
+1.000 +4.000 +5.000
+2.000 +9.000 +8.000
+2.000 +9.000 +9.000
-1.000 -4.000 -5.000
Press return to continue.
------------------------------------
Check if the columns of B are linearly independent
BT :
+1 +2 +2 -1
+4 +9 +9 -4
+5 +8 +9 -5
BTb :
+1 +2 +2 -1 +0
+4 +9 +9 -4 +0
+5 +8 +9 -5 +0
gj_PP_FreeV_mZ(BTb) :
+1.0000 +1.6000 +1.8000 -1.0000 +0.0000
+0.0000 +1.0000 +0.6923 +0.0000 +0.0000
-0.0000 -0.0000 +1.0000 -0.0000 -0.0000
Press return to continue.