SommaireUtilise la commande "Retour en Arrière" de ton navigateur.


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 **A    = i_mR(r,r);
double **b    = i_mR(r,C1);
double **Ab   = i_Abr_Ac_bc_mR(r,r,C1);

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

double **invR_Q_T = i_mR(r,r);
double **x        = i_mR(r,C1); // x invR * Q_T * b

 do
  {
   r_mR(A,999.);
   printf(".");
  }while(!det_R(A));

  clrscrn();
  printf(" A :");
  p_mR(A,S8,P0,C7);
  printf(" b :");
  r_mR(b,999.);
  p_mR(b,S8,P0,C7);
  printf(" Ab :");
  c_A_b_Ab_mR(A,b,Ab);
  p_mR(Ab,S8,P0,C7);
  stop();
    
  clrscrn();
  QR_mR(A,Q,R);    
  printf(" Q :");
  p_mR(Q,S3,P4,C6);  
  printf(" R :");
  p_mR(R,S10,P4,C6);
  stop();

  clrscrn();
  transpose_mR(Q,Q_T);   
  printf(" Q_T :");
  pE_mR(Q_T,S3,P4,C6); 
  inv_mR(R,invR); 
  printf(" invR :");
  pE_mR(invR,S10,P4,C6);
  stop();
  
  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf(" rref(Ab,.00000000001)\n\n");
  stop();
  
  clrscrn();
  printf(" gj_TP_mR(Ab) :");
  gj_TP_mR(Ab);
  p_mR(Ab,S10,P4,C7);

  mul_mR(invR,Q_T,invR_Q_T);
  mul_mR(invR_Q_T,b,x);
  printf(" x = invR * Q_T * b :");
  p_mR(x,S10,P4,C6);

  f_mR(A);
  f_mR(b);
  f_mR(Ab);
  f_mR(Q);
  f_mR(Q_T);
  f_mR(R);
  f_mR(invR);  
  f_mR(invR_Q_T); 
  f_mR(x); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC5)+R1);


} while(stop_w());

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


On obtient le même résultat qu'avec la méthode de gauss jordan



Exemple de sortie écran :
 -----------------------------------
 A :
    +303     +668     +458     +849     +842 
    +160     -201     +648     -117     -704 
    +531     +986     -696     +611     -443 
    -153     -265     -901     -208     -589 
    -306      +39     +119      -82     +364 

 b :
    -393 
    +296 
    +381 
     -64 
    -477 

 Ab :
    +303     +668     +458     +849     +842     -393 
    +160     -201     +648     -117     -704     +296 
    +531     +986     -696     +611     -443     +381 
    -153     -265     -901     -208     -589      -64 
    -306      +39     +119      -82     +364     -477 

 Press return to continue. 


 -----------------------------------
 Q :
+0.4216 +0.3386 +0.4293 +0.7050 -0.1621 
+0.2226 -0.5892 +0.3447 -0.2125 -0.6628 
+0.7389 +0.3372 -0.4144 -0.3846 -0.1437 
-0.2129 -0.0707 -0.6873 +0.4615 -0.5141 
-0.4258 +0.6477 +0.2299 -0.3112 -0.4994 

 R :
 +718.6202 +1005.2890   -35.7393  +862.6031  -158.6568 
   +0.0000  +721.0832  -320.6643  +524.0055  +827.8365 
   +0.0000    -0.0000 +1354.9698  +195.0440  +790.8400 
   +0.0000    +0.0000    -0.0000  +317.9480  +528.4995 
   -0.0000    +0.0000    +0.0000    +0.0000  +514.8021 

 Press return to continue. 


 -----------------------------------
 Q_T :
+4.2164e-01 +2.2265e-01 +7.3892e-01 -2.1291e-01 -4.2582e-01 
+3.3856e-01 -5.8915e-01 +3.3724e-01 -7.0680e-02 +6.4773e-01 
+4.2926e-01 +3.4469e-01 -4.1436e-01 -6.8730e-01 +2.2988e-01 
+7.0502e-01 -2.1251e-01 -3.8461e-01 +4.6154e-01 -3.1119e-01 
-1.6211e-01 -6.6284e-01 -1.4371e-01 -5.1407e-01 -4.9944e-01 

 invR :
+1.3916e-03 -1.9400e-03 -4.2242e-04 -3.1889e-04 +4.5248e-03 
+0.0000e+00 +1.3868e-03 +3.2820e-04 -2.4869e-03 -1.8118e-04 
+0.0000e+00 -0.0000e+00 +7.3802e-04 -4.5274e-04 -6.6897e-04 
+0.0000e+00 -0.0000e+00 +0.0000e+00 +3.1452e-03 -3.2289e-03 
-0.0000e+00 +0.0000e+00 -0.0000e+00 -0.0000e+00 +1.9425e-03 

 Press return to continue. 


 -----------------------------------
 Copy/Past into the octave window.

 Ab=[
+303,+668,+458,+849,+842,-393;
+160,-201,+648,-117,-704,+296;
+531,+986,-696,+611,-443,+381;
-153,-265,-901,-208,-589,-64;
-306,+39,+119,-82,+364,-477]

 rref(Ab,.00000000001)

 Press return to continue. 


 -----------------------------------
 gj_TP_mR(Ab) :
   +1.0000    -0.0000    -0.0000    +0.0000    -0.0000    +2.1117 
   +0.0000    +1.0000    +0.0000    +0.0000    +0.0000    +0.1334 
   +0.0000    +0.0000    +1.0000    +0.0000    +0.0000    -0.1039 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000    -1.4271 
   -0.0000    +0.0000    +0.0000    +0.0000    +1.0000    +0.1630 

 x = invR * Q_T * b :
   +2.1117 
   +0.1334 
   -0.1039 
   -1.4271 
   +0.1630 


 Press return to continue
 Press X      to stop