Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A      = rlower_mZ(i_mZ(r,r),9.);
double **Q      =           i_mZ(r,r);
double **R      =           i_mZ(r,r);

  clrscrn();
  printf(" A :");
  P_mZ(A, S3,P0, S2,P0, C6);

  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mZ(A,"a",P0,P0);
  printf(" [Q, R] = qr (a,0) \n\n");
  stop();
 
  clrscrn();
  QR_mZ(A,Q,R);    
  printf(" Q :");
  p_mZ(Q, S8,P4, S8,P4, C6);
  printf(" R :");
  p_mZ(R, S8,P4, S8,P4, C6);
  stop();
  
  clrscrn();
  printf(" A :");
  p_mZ(A, S8,P4, S8,P4, C6);
  
  printf(" A = Q * R  :");  
  mul_mZ(Q,R, A);
  p_mZ(A, S8,P4, S8,P4, C6);
  
  f_mZ(A);
  f_mZ(Q);
  f_mZ(R);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R3)+R1);

} while(stop_w());

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


La QR décomposition d'une matrice triangulaire inférieur


Exemple de sortie écran :

 A :
 +6,+8,  +0,+0,  +0,+0,  +0,+0, 
 +9,-3,  +8,+5,  +0,+0,  +0,+0, 
 -3,-9,  -9,-4,  +9,-1,  +0,+0, 
 +6,-3,  -9,+7,  +4,+3,  -5,+4  

 Copy/Past into the octave windows 

 a=[
+6+8*i,+0+0*i,+0+0*i,+0+0*i;
+9-3*i,+8+5*i,+0+0*i,+0+0*i;
-3-9*i,-9-4*i,+9-1*i,+0+0*i;
+6-3*i,-9+7*i,+4+3*i,-5+4*i]

 [Q, R] = qr (a,0) 

 Press return to continue. 


 Q :
 +0.3328 +0.4438i  -0.0263 -0.0788i  +0.4826 -0.4264i  -0.1781 +0.4889i 
 +0.4992 -0.1664i  +0.3763 +0.2844i  +0.1166 -0.1811i  -0.4008 -0.5418i 
 -0.1664 -0.4992i  -0.5119 -0.1488i  +0.5476 -0.2734i  +0.0359 -0.2510i 
 +0.3328 -0.1664i  -0.5671 +0.4060i  -0.1225 +0.3864i  -0.3585 +0.2868i 

 R :
+18.0278 +0.0000i  +2.4962 +0.8321i  -0.1664 +6.3236i  -2.3297 +0.4992i 
 +0.0000 -0.0000i +17.5806 +0.0000i  -5.5087 -1.4745i  +4.4595 -0.2380i 
 +0.0000 -0.0000i  -0.0000 +0.0000i  +5.8707 +0.0000i  +2.1582 +1.4417i 
 -0.0000 +0.0000i  +0.0000 -0.0000i  +0.0000 +0.0000i  +2.9399 +0.0000i 

 Press return to continue. 


 A :
 +6.0000 +8.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 
 +9.0000 -3.0000i  +8.0000 +5.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 
 -3.0000 -9.0000i  -9.0000 -4.0000i  +9.0000 -1.0000i  +0.0000 +0.0000i 
 +6.0000 -3.0000i  -9.0000 +7.0000i  +4.0000 +3.0000i  -5.0000 +4.0000i 

 A = Q * R  :
 +6.0000 +8.0000i  -0.0000 +0.0000i  +0.0000 -0.0000i  +0.0000 -0.0000i 
 +9.0000 -3.0000i  +8.0000 +5.0000i  +0.0000 -0.0000i  +0.0000 +0.0000i 
 -3.0000 -9.0000i  -9.0000 -4.0000i  +9.0000 -1.0000i  +0.0000 +0.0000i 
 +6.0000 -3.0000i  -9.0000 +7.0000i  +4.0000 +3.0000i  -5.0000 +4.0000i 


 Press   return to continue
 Press X return to stop