Mathc matrices/c24d
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c05c.c */
int main(void)
double a_Tb[RA*(CA+C1)]={
 2,0,0,4,1,0,
 0,3,0,5,0,0
double **A_Tb = ca_A_mR(a_Tb,i_Abr_Ac_bc_mR(RA,CA,C1));
double **A_T = c_Ab_A_mR(A_Tb,i_mR(RA,CA));
double **b = c_Ab_b_mR(A_Tb,i_mR(RA,C1));
double **A_Tb_free = i_Abr_Ac_bc_mR(csize_A_R(A_Tb),csize_A_R(A_Tb),CFREE);
double **B = i_mR(rsize_R(A_Tb_free),csize_b_R(A_Tb_free)); 
int r;
 clrscrn();
 printf("Find a basis for the orthogonal complement of A :\n\n");
 printf(" A_T :");
 p_mR(A_T,S6,P1,C10);
 printf(" b :");
 p_mR(b,S6,P1,C10);
 printf(" A_Tb :");
 p_mR(A_Tb,S6,P1,C10);
 stop();
 clrscrn();
 printf(" A_Tb : gj_PP_mR(A_Tb,NO) :");
 gj_PP_mR(A_Tb,NO);
 p_mR(A_Tb,S7,P3,C10);
 put_var_mR(A_Tb,A_Tb_free); 
 put_freeV_mR(A_Tb_free);
 r = rsize_R(A_Tb_free);
 while(r>R1) 
 zero_below_pivot_gj1Ab_mR(A_Tb_free,r--);
 stop();
 clrscrn(); 
 printf(" A_Tb_free :"); 
 p_mR(A_Tb_free,S7,P3,C10); 
 printf(" B is a basis for the orthogonal complement of A :"); 
 P_mR(c_Ab_b_mR(A_Tb_free,B),S10,P12,C7);
 stop(); 
 f_mR(A_Tb);
 f_mR(A_Tb_free);
 f_mR(B);
 f_mR(b);
 f_mR(A_T);
 return 0;
/* ------------------------------------ */
Trouver une projection sur un sous-espace vectoriel par une application linéaire :
 Proj(x) = V * x
 V = Id - (B * inv(BT*B) * BT) .

Exemple de sortie écran :
Find a basis for the orthogonal complement of A :
 A_T :
 +2.0 +0.0 +0.0 +4.0 +1.0 
 +0.0 +3.0 +0.0 +5.0 +0.0 
 b :
 +0.0 
 +0.0 
 A_Tb :
 +2.0 +0.0 +0.0 +4.0 +1.0 +0.0 
 +0.0 +3.0 +0.0 +5.0 +0.0 +0.0 
 Press return to continue. 
 ------------------------------------ 
 A_Tb : gj_PP_mR(A_Tb,NO) :
 +1.000 +0.000 +0.000 +2.000 +0.500 +0.000 
 +0.000 +1.000 +0.000 +1.667 +0.000 +0.000 
 Press return to continue. 
 A_Tb_free :
 +1.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 -2.000 -0.500 
 +0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +0.000 -1.667 +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 +1.000 +0.000 +0.000 +0.000 +1.000 +0.000 
 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +1.000 
 B is a basis for the orthogonal complement of A :
+0.000000000000, +0.000000000000, -2.000000000000, -0.500000000000, 
+0.000000000000, +0.000000000000, -1.666666666667, +0.000000000000, 
+0.000000000000, +1.000000000000, +0.000000000000, +0.000000000000, 
+0.000000000000, +0.000000000000, +1.000000000000, +0.000000000000, 
+0.000000000000, +0.000000000000, +0.000000000000, +1.000000000000 
 Press return to continue.

Mathc matrices/c23w
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c03d.c */
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
double b[RB*(CB)]={
 +0.333333333333, 
 +0.666666666667, 
 +1.000000000000 
double x[RB*C1]={
 -1, 
 2, 
 -3
double **B = ca_A_mR(b,i_mR(RB,CB));
double **BT = i_mR(CB,RB);
double **BTB = i_mR(CB,CB); // BT*B
double **invBTB = i_mR(CB,CB); // inv(BT*B)
double **invBTB_BT = i_mR(CB,RB); // inv(BT*B)*BT
double **B_invBTB_BT = i_mR(RB,RB); // B_inv(BT*B)*BT
double **Id = eye_mR(i_mR(RB,RB));
double **V = i_mR(RB,RB); // V = Id - (B_inv(BT*B)*BT)
double **X = ca_A_mR(x,i_mR(RB,C1));
double **VX = i_mR(RB,C1);
 clrscrn();
 printf(" B is a basis for the orthogonal complement of A : \n\n"
 " Find a transformation matrix for \n"
 " a projection onto R%d : \n\n"
 " Proj(x) = [Id-(B*inv(BT*B)*BT)] * x \n\n",RB);
 printf(" B :");
 p_mR(B,S5,P4,C7);
 stop();
 clrscrn();
 printf(" BT :");
 p_mR(transpose_mR(B,BT),S5,P4,C7);
 printf(" BTB :");
 p_mR(mul_mR(BT,B,BTB),S5,P4,C7);
 printf(" inv(BT*A) :");
 invBTB[R1][C1] = 1./BTB[R1][C1];
 p_mR(invBTB,S5,P4,C7); 
 printf(" inv(BT*B)*BT :");
 p_mR(mul_mR(invBTB,BT,invBTB_BT),S5,P4,C7); 
 printf(" B*inv(BT*B)*BT :");
 p_mR(mul_mR(B,invBTB_BT,B_invBTB_BT),S5,P4,C7); 
 printf(" V = Id - (B*inv(BT*B)*BT) :");
 p_mR(sub_mR(Id,B_invBTB_BT,V),S5,P4,C7); 
 stop(); 
 clrscrn();
 printf(" V is transformation matrix for \n"
 " a projection onto a subspace R%d :\n\n",RB);
 p_mR(V,S5,P4,C7); 
 printf(" X :");
 p_mR(X,S5,P4,C7);
 printf(" Proj(x) = [Id-(B*inv(BT*B)*BT)] * x \n\n"); 
 printf(" Proj(x) = V * x :"); 
 p_mR(mul_mR(V,X,VX),S5,P4,C7); 
 stop();

f_mR(B);
 f_mR(BT);
 f_mR(BTB); // BT*B
 f_mR(invBTB); // inv(BT*B)
 f_mR(invBTB_BT); // inv(BT*B)*BT
 f_mR(V); // B*inv(BT*B)*BT 
 f_mR(X); 
 f_mR(VX); 
 return 0;
/* ------------------------------------ */
Trouver une projection sur un sous-espace vectoriel par une application linéaire :
 Proj(x) = V * x
 V = Id - (B * inv(BT*B) * BT) .

Exemple de sortie écran :
 B is a basis for the orthogonal complement of A : 
 Find a transformation matrix for 
 a projection onto R3 : 
 Proj(x) = [Id-(B*inv(BT*B)*BT)] * x 
 B :
+0.3333 
+0.6667 
+1.0000 
 Press return to continue. 
 ------------------------------------ 
 BT :
+0.3333 +0.6667 +1.0000 
 BTB :
+1.5556 
 inv(BT*A) :
+0.6429 
 inv(BT*B)*BT :
+0.2143 +0.4286 +0.6429 
 B*inv(BT*B)*BT :
+0.0714 +0.1429 +0.2143 
+0.1429 +0.2857 +0.4286 
+0.2143 +0.4286 +0.6429 
 V = Id - (B*inv(BT*B)*BT) :
+0.9286 -0.1429 -0.2143 
-0.1429 +0.7143 -0.4286 
-0.2143 -0.4286 +0.3571 
 Press return to continue. 
 ------------------------------------ 
 V is transformation matrix for 
 a projection onto a subspace R3 :
+0.9286 -0.1429 -0.2143 
-0.1429 +0.7143 -0.4286 
-0.2143 -0.4286 +0.3571 
 X :
-1.0000 
+2.0000 
-3.0000 
 Proj(x) = [Id-(B*inv(BT*B)*BT)] * x 
 Proj(x) = V * x :
-0.5714 
+2.8571 
-1.7143 
 Press return to continue.

Mathc matrices/c24a
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c04d.c */
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
double b[RB*(CB)]={
 +0.000000000000, -2.000000000000, 
 +0.000000000000, -1.666666666667, 
 +1.000000000000, +0.000000000000, 
 +0.000000000000, +1.000000000000
double x[RB*(C1)]={
 -1, 
 2, 
 -3,
 -3,
double **B = ca_A_mR(b,i_mR(RB,CB));
double **BT = i_mR(CB,RB);
double **BTB = i_mR(CB,CB); // BT*B
double **invBTB = i_mR(CB,CB); // inv(BT*B)
double **invBTB_BT = i_mR(CB,RB); // inv(BT*B)*BT
double **B_invBTB_BT = i_mR(RB,RB); // B_inv(BT*B)*BT
double **Id = eye_mR(i_mR(RB,RB));
double **V = i_mR(RB,RB); // V = Id - (B_inv(BT*B)*BT)
double **X = ca_A_mR(x,i_mR(RB,C1));
double **VX = i_mR(RB,C1);
 clrscrn();
 printf(" B is a basis for the orthogonal complement of A : \n\n"
 " Find a transformation matrix for \n"
 " a projection onto R%d : \n\n"
 " Proj(x) = [Id-(B*inv(BT*B)*BT)] * x \n\n",RB);
 printf(" B :");
 p_mR(B,S5,P4,C7);
 stop();
 clrscrn();
 printf(" BT :");
 p_mR(transpose_mR(B,BT),S5,P4,C7);
 printf(" BTB :");
 p_mR(mul_mR(BT,B,BTB),S5,P4,C7);
 printf(" inv(BT*B) :");
 p_mR(inv_mR(BTB,invBTB),S5,P4,C7); 
 printf(" inv(BT*B)*BT :");
 p_mR(mul_mR(invBTB,BT,invBTB_BT),S5,P4,C7); 
 printf(" B*inv(BT*B)*BT :");
 p_mR(mul_mR(B,invBTB_BT,B_invBTB_BT),S5,P4,C7); 
 printf(" V = Id - (B*inv(BT*B)*BT) :");
 p_mR(sub_mR(Id,B_invBTB_BT,V),S5,P4,C7); 
 stop(); 
 clrscrn();
 printf(" V is transformation matrix for \n"
 " a projection onto a subspace R%d :\n\n",RB);
 p_mR(V,S5,P4,C7); 
 printf(" Proj(x) = [Id-(B*inv(BT*B)*BT)] * x \n\n"); 
 printf(" Proj(x) = V * x :"); 
 p_mR(mul_mR(V,X,VX),S5,P4,C7); 
 stop();

f_mR(B);
 f_mR(BT);
 f_mR(BTB); // BT*B
 f_mR(invBTB); // inv(BT*B)
 f_mR(invBTB_BT); // inv(BT*B)*BT
 f_mR(V); // B*inv(BT*B)*BT 
 f_mR(X); 
 f_mR(VX); 
/* ------------------------------------ */
int main(void)

fun();
 return 0;
/* ------------------------------------ */
Trouver une projection sur un sous-espace vectoriel par une application linéaire :
 Proj(x) = V * x
 V = Id - (B * inv(BT*B) * BT) .