Aller au contenu

Mathc matrices/00s

Un livre de Wikilivres.


Matrice de Hankel

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

c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U    = r_mR(          i_mR(R1,r),9);
double **V    = r_mR(          i_mR(r,C1),9);	
double **A    = rHankel_mR(U,V,i_mR(r,r)   );
double **AInv =                i_mR(r,r);

double **Q    =                i_mR(r,r);
double **Q_T  =                i_mR(r,r);
double **R    =                i_mR(r,r);
double **RInv =                i_mR(r,r);

  clrscrn();
  printf(" A :");
  P_mR(A,S5,P3,C7); 

  QR_mR(A,Q,R);    
  printf(" Q :");
  p_mR(Q,S8,P4,C7);  
  printf(" R :");
  p_mR(R,S8,P4,C7);
  stop();

  clrscrn();
  printf(" Q_T  = QInv :");
  p_mR(transpose_mR(Q,Q_T),S8,P4,C7);
  printf(" Rinv :");
  p_mR(inv_mR(R,RInv),S8,P4,C7);
  stop();

  clrscrn();
  printf(" Inverse of A :");
  p_mR(inv_mR(A,AInv),S5,P4,C7);
  
  printf(" RInv QInv = RInv Q_T :");  
  p_mR(mul_mR(RInv,Q_T,AInv),S5,P4,C7);  

  f_mR(U);
  f_mR(V);  
  f_mR(A);
  f_mR(AInv);
  f_mR(Q);
  f_mR(R);
  f_mR(Q_T);
  f_mR(RInv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(RC3)+C2);

} while(stop_w());

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


Matrice de Hankel.

Exemple de sortie écran :

 A :
+4.000, +9.000, -4.000, +8.000, 
+9.000, -4.000, +8.000, -4.000, 
-4.000, +8.000, -4.000, -4.000, 
+8.000, -4.000, -4.000, -9.000  

 Q :
 +0.3007  +0.8422  -0.0216  +0.4471 
 +0.6765  -0.0601  +0.6656  -0.3095 
 -0.3007  +0.5284  -0.0159  -0.7938 
 +0.6013  -0.0893  -0.7459  -0.2723 

 R :
+13.3041  -4.8105  +3.0066  -4.5099 
 +0.0000 +12.4040  -5.6060  +5.6679 
 +0.0000  -0.0000  +8.4577  +3.9412 
 -0.0000  -0.0000  +0.0000 +10.4404 

 Press return to continue. 


 Q_T  = QInv :
 +0.3007  +0.6765  -0.3007  +0.6013 
 +0.8422  -0.0601  +0.5284  -0.0893 
 -0.0216  +0.6656  -0.0159  -0.7459 
 +0.4471  -0.3095  -0.7938  -0.2723 

 Rinv :
 +0.0752  +0.0292  -0.0074  +0.0194 
 -0.0000  +0.0806  +0.0534  -0.0639 
 -0.0000  -0.0000  +0.1182  -0.0446 
 -0.0000  -0.0000  -0.0000  +0.0958 

 Press return to continue. 


 Inverse of A :
+0.0560 +0.0382 -0.0225 +0.0428 
+0.0382 +0.0505 +0.0925 -0.0296 
-0.0225 +0.0925 +0.0336 -0.0760 
+0.0428 -0.0296 -0.0760 -0.0261 

 RInv QInv = RInv Q_T :
+0.0560 +0.0382 -0.0225 +0.0428 
+0.0382 +0.0505 +0.0925 -0.0296 
-0.0225 +0.0925 +0.0336 -0.0760 
+0.0428 -0.0296 -0.0760 -0.0261 


 Press   return to continue
 Press X return to stop