Application


Installer et compiler ces fichiers dans votre répertoire de travail.


c04d.c
/* ------------------------------------ */
/*  Save as :   c04d.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define    RB R4
#define    CB C2
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double b[RB*(CB*C2)]={
 +0.072961373391,-0.506437768240, +1.534334763948,-0.444206008584, 
 -1.373390557940,-0.231759656652, -1.263948497854,-0.491416309013, 
 +1.000000000000,+0.000000000000, -0.000000000000,+0.000000000000, 
 -0.000000000000,-0.000000000000, +1.000000000000,-0.000000000000  
};

double x[RB*(C1*C2)]={
 -1,-3, 
  2,-4, 
 -3,-5,
 -1,-2,
};

double **B           = ca_A_mZ(b,i_mZ(RB,CB));
double **BT          = i_mZ(CB,RB);
double **BTB         = i_mZ(CB,CB); //         BT*B
double **invBTB      = i_mZ(CB,CB); //     inv(BT*B)
double **invBTB_BT   = i_mZ(CB,RB); //     inv(BT*B)*BT
double **B_invBTB_BT = i_mZ(RB,RB); //     B_inv(BT*B)*BT

double **Id          = eye_mZ(i_mZ(RB,RB));
double **V           = i_mZ(RB,RB); //     V = Id - (B_inv(BT*B)*BT)

double **X           = ca_A_mZ(x,i_mZ(RB,C1));
double **VX          =           i_mZ(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_mZ(B,S5,P4,S5,P4,C7);
  stop();
  
  clrscrn();
  printf(" BT :");
  p_mZ(ctranspose_mZ(B,BT),S5,P4,S5,P4,C7);
  printf(" BTB :");
  p_mZ(mul_mZ(BT,B,BTB),S5,P4,S5,P4,C7);
  
  printf(" inv(BT*B) :");
  
  printf(" inv(BT*B) :");
  p_mZ(invgj_mZ(BTB,invBTB),S5,P4,S5,P4,C7);  
  
  printf(" inv(BT*B)*BT :");
  p_mZ(mul_mZ(invBTB,BT,invBTB_BT),S5,P4,S5,P4,C7); 
  printf(" B*inv(BT*B)*BT :");
  p_mZ(mul_mZ(B,invBTB_BT,B_invBTB_BT),S5,P4,S5,P4,C7);  
  printf(" V = Id - (B*inv(BT*B)*BT) :");
  p_mZ(sub_mZ(Id,B_invBTB_BT,V),S5,P4,S5,P4,C7);    
  stop();  
  
  clrscrn();
  printf(" V is transformation matrix for     \n"
         " a projection onto a subspace R%d :\n\n",RB);
  p_mZ(V,S5,P4,S5,P4,C7); 
  
  printf(" X :");
  p_mZ(X,S5,P1,S5,P1,C7);
  
  printf(" Proj(x) = [Id-(B*inv(BT*B)*BT)] * x \n\n"); 
  printf(" Proj(x) =  V                    * x :");  
  p_mZ(mul_mZ(V,X,VX),S5,P4,S5,P4,C7); 
  stop();    
  
  
  f_mZ(B);
  f_mZ(BT);
  f_mZ(BTB);       //         BT*B
  f_mZ(invBTB);    //     inv(BT*B)
  f_mZ(invBTB_BT); //     inv(BT*B)*BT
  f_mZ(V);         //   B*inv(BT*B)*BT  
  
  f_mZ(X); 
  f_mZ(VX);         

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Trouver une projection sur un sous-espace vectoriel par une application linéaire :


  • B est une base pour le complément orthogonal de A. Trouver une matrice V qui projette un vecteur x sur R4.
          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 R4  :          

 Proj(x) = [Id-(B*inv(BT*B)*BT)] * x 

 B :
+0.0730-0.5064i +1.5343-0.4442i 
-1.3734-0.2318i -1.2639-0.4914i 
+1.0000+0.0000i -0.0000+0.0000i 
-0.0000-0.0000i +1.0000-0.0000i 

 Press return to continue. 

 ------------------------------------ 
 BT :
+0.0730+0.5064i -1.3734+0.2318i +1.0000-0.0000i -0.0000+0.0000i 
+1.5343+0.4442i -1.2639+0.4914i -0.0000-0.0000i +1.0000+0.0000i 

 BTB :
+3.2017+0.0000i +2.1867+1.1266i 
+2.1867-1.1266i +5.3906+0.0000i 

 inv(BT*B) : inv(BT*B) :
+0.4809-0.0000i -0.1951-0.1005i 
-0.1951+0.1005i +0.2857+0.0000i 

 inv(BT*B)*BT :
-0.2196+0.0027i -0.3645+0.1426i +0.4809-0.0000i -0.1951-0.1005i 
+0.3732+0.0354i -0.1164-0.0429i -0.1951+0.1005i +0.2857+0.0000i 

 B*inv(BT*B)*BT :
+0.5736+0.0000i -0.1520+0.1809i -0.2196-0.0027i +0.3732-0.0354i 
-0.1520-0.1809i +0.6598-0.0000i -0.3645-0.1426i -0.1164+0.0429i 
-0.2196+0.0027i -0.3645+0.1426i +0.4809-0.0000i -0.1951-0.1005i 
+0.3732+0.0354i -0.1164-0.0429i -0.1951+0.1005i +0.2857+0.0000i 

 V = Id - (B*inv(BT*B)*BT) :
+0.4264-0.0000i +0.1520-0.1809i +0.2196+0.0027i -0.3732+0.0354i 
+0.1520+0.1809i +0.3402+0.0000i +0.3645+0.1426i +0.1164-0.0429i 
+0.2196-0.0027i +0.3645-0.1426i +0.5191+0.0000i +0.1951+0.1005i 
-0.3732-0.0354i +0.1164+0.0429i +0.1951-0.1005i +0.7143+0.0000i 

 Press return to continue. 


 ------------------------------------ 
 V is transformation matrix for     
 a projection onto a subspace R4 :


+0.4264-0.0000i +0.1520-0.1809i +0.2196+0.0027i -0.3732+0.0354i 
+0.1520+0.1809i +0.3402+0.0000i +0.3645+0.1426i +0.1164-0.0429i 
+0.2196-0.0027i +0.3645-0.1426i +0.5191+0.0000i +0.1951+0.1005i 
-0.3732-0.0354i +0.1164+0.0429i +0.1951-0.1005i +0.7143+0.0000i 

 X :
 -1.0 -3.0i 
 +2.0 -4.0i 
 -3.0 -5.0i 
 -1.0 -2.0i 

 Proj(x) = [Id-(B*inv(BT*B)*BT)] * x 

 Proj(x) =  V                    * x :
-1.0475-2.6443i 
+0.4886-4.4384i 
-1.6203-5.4855i 
-1.1310-1.3276i 

 Press return to continue.