Mathc matrices/c21u
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double ab[R4*C7]={
+1, 3, -2, 0, +2, +0, 0,
0, 0, -5, -3, +4, -3, 0,
0, 0, +10, 6, -8, +6, 0,
1, 0, 0, 0, 4, 8, 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 **Ab_free = i_Abr_Ac_bc_mR(csize_A_R(Ab),csize_A_R(Ab),C1+C3);
double **b_free = i_mR(rsize_R(Ab_free),csize_b_R(Ab_free));
double **A_bfree = i_mR(rsize_R(A),csize_R(b_free)) ;
int r;
clrscrn();
printf("Find a basis for the orthogonal complement of A :\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(" Ab : gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab,S7,P3,C10);
put_zeroR_mR(Ab,Ab_free);
// printf(" Ab_free : put_zeroR_mR(Ab,Ab_free);");
// p_mR(Ab_free,S7,P3,C10);
put_freeV_mR(Ab_free);
// printf(" Ab_free : put_freeV_mR(Ab_free);");
// p_mR(Ab_free,S7,P3,C10);
stop();
clrscrn();
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,S7,P3,C10);
c_Ab_b_mR(Ab_free,b_free);
// printf(" b_free :");
// p_mR(b_free,S10,P3,C7);
printf(" b_free : free variables");
p_freeV(b_free,S6,P3);
stop();
clrscrn();
printf(" A :");
p_mR(A,S10,P3,C10);
printf(" b_free :");
p_mR(b_free,S10,P3,C7);
printf(" A * bfree :");
p_mR(mul_mR(A,b_free,A_bfree),S10,P3,C7);
stop();
f_mR(Ab);
f_mR(Ab_free);
f_mR(b_free);
f_mR(b);
f_mR(A);
f_mR(A_bfree);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
On commence par calculer les variables libres.
Les colonnes de b_free sont une base pour le complément orthogonal de A.
A * b_free = 0
Cela prouve que les vecteurs lignes de A sont orthogonaux aux vecteurs colonnes de b_free.
Exemple de sortie écran :
------------------------------------
Find a basis for the orthogonal complement of A :
A :
+1.0 +3.0 -2.0 +0.0 +2.0 +0.0
+0.0 +0.0 -5.0 -3.0 +4.0 -3.0
+0.0 +0.0 +10.0 +6.0 -8.0 +6.0
+1.0 +0.0 +0.0 +0.0 +4.0 +8.0
b :
+0.0
+0.0
+0.0
+0.0
Ab :
+1.0 +3.0 -2.0 +0.0 +2.0 +0.0 +0.0
+0.0 +0.0 -5.0 -3.0 +4.0 -3.0 +0.0
+0.0 +0.0 +10.0 +6.0 -8.0 +6.0 +0.0
+1.0 +0.0 +0.0 +0.0 +4.0 +8.0 +0.0
Press return to continue.
------------------------------------
Ab : gj_PP_mR(Ab,NO) :
+1.000 +3.000 -2.000 +0.000 +2.000 +0.000 +0.000
-0.000 +1.000 -0.667 -0.000 -0.667 -2.667 -0.000
+0.000 +0.000 +1.000 +0.600 -0.800 +0.600 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000
Press return to continue.
------------------------------------
Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);
+1.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 -4.000 -8.000
+0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +0.000 -0.400 +1.200 +2.267
+0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +0.000 -0.600 +0.800 -0.600
+0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +1.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +1.000
b_free : free variables
x1 = +0.000 +0.000*s -4.000*t -8.000*u
x2 = +0.000 -0.400*s +1.200*t +2.267*u
x3 = +0.000 -0.600*s +0.800*t -0.600*u
x4 = +0.000 +1.000*s +0.000*t +0.000*u
x5 = +0.000 +0.000*s +1.000*t +0.000*u
x6 = +0.000 +0.000*s +0.000*t +1.000*u
Press return to continue.
------------------------------------
A :
+1.000 +3.000 -2.000 +0.000 +2.000 +0.000
+0.000 +0.000 -5.000 -3.000 +4.000 -3.000
+0.000 +0.000 +10.000 +6.000 -8.000 +6.000
+1.000 +0.000 +0.000 +0.000 +4.000 +8.000
b_free :
+0.000 +0.000 -4.000 -8.000
+0.000 -0.400 +1.200 +2.267
+0.000 -0.600 +0.800 -0.600
+0.000 +1.000 +0.000 +0.000
+0.000 +0.000 +1.000 +0.000
+0.000 +0.000 +0.000 +1.000
A * bfree :
+0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000
+0.000 -0.000 +0.000 -0.000
+0.000 +0.000 +0.000 +0.000
Press return to continue.