Aller au contenu

Mathc matrices/00t

Un livre de Wikilivres.


Matrices de Toeplitz

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    = rToeplitz_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 Toeplitz.

Exemple de sortie écran :

 A :
-9.000, -2.000, +5.000, -3.000, -5.000, 
-9.000, -9.000, -2.000, +5.000, -3.000, 
+5.000, -9.000, -9.000, -2.000, +5.000, 
-2.000, +5.000, -9.000, -9.000, -2.000, 
+3.000, -2.000, +5.000, -9.000, -9.000  

 Q :
 -0.6364  -0.0212  +0.2344  -0.3912  +0.6218 
 -0.6364  -0.5320  -0.1521  +0.1550  -0.5146 
 +0.3536  -0.7261  -0.4131  -0.1750  +0.3828 
 -0.1414  +0.3926  -0.7492  -0.4897  -0.1570 
 +0.2121  -0.1875  +0.4358  -0.7433  -0.4212 

 R :
+14.1421  +2.6870  -2.7577  -2.6163  +5.2326 
 +0.0000 +13.7033  +3.0219  -2.9898  -1.0260 
 +0.0000  +0.0000 +14.1161  +2.1833  -5.2047 
 -0.0000  +0.0000  -0.0000 +13.3959  +8.2851 
 -0.0000  -0.0000  +0.0000  +0.0000  +4.4538 

 Press return to continue. 


 Q_T  = QInv :
 -0.6364  -0.6364  +0.3536  -0.1414  +0.2121 
 -0.0212  -0.5320  -0.7261  +0.3926  -0.1875 
 +0.2344  -0.1521  -0.4131  -0.7492  +0.4358 
 -0.3912  +0.1550  -0.1750  -0.4897  -0.7433 
 +0.6218  -0.5146  +0.3828  -0.1570  -0.4212 

 Rinv :
 +0.0707  -0.0139  +0.0168  +0.0080  -0.0815 
 -0.0000  +0.0730  -0.0156  +0.0188  -0.0365 
 -0.0000  -0.0000  +0.0708  -0.0115  +0.1043 
 +0.0000  +0.0000  +0.0000  +0.0746  -0.1389 
 -0.0000  -0.0000  -0.0000  -0.0000  +0.2245 

 Press return to continue. 


 Inverse of A :
-0.0946 +0.0030 -0.0045 -0.0191 +0.0533 
-0.0353 -0.0148 -0.0638 +0.0369 -0.0191 
+0.0859 -0.0662 +0.0127 -0.0638 -0.0045 
-0.1155 +0.0830 -0.0662 -0.0148 +0.0030 
+0.1396 -0.1155 +0.0859 -0.0353 -0.0946 

 RInv QInv = RInv Q_T :
-0.0946 +0.0030 -0.0045 -0.0191 +0.0533 
-0.0353 -0.0148 -0.0638 +0.0369 -0.0191 
+0.0859 -0.0662 +0.0127 -0.0638 -0.0045 
-0.1155 +0.0830 -0.0662 -0.0148 +0.0030 
+0.1396 -0.1155 +0.0859 -0.0353 -0.0946 


 Press   return to continue
 Press X return to stop