Aller au contenu

Mathc complexes/c05n

Un livre de Wikilivres.


Application


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

c01n.c
/* ------------------------------------ */
/*  Save as :   c01n.c                   */
/* ------------------------------------ */

/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r,int rn)
{
double **A      = r_mZ(i_mZ(r+rn,r),99.);
double **Q      =      i_mZ(r+rn,r);
double **R      =      i_mZ(r,r);
double **T      =      i_mZ(r+rn,r);

  clrscrn();
  printf(" A :");
  p_mZ(A, S8,P0, S2,P0, C6);  
  
  QR_mZ(A,Q,R);
    
  printf(" Q :");
  p_mZ(Q, S10,P4, S9,P4, C6); 
  
  printf(" R :");
  p_mZ(R, S10,P4, S9,P4, C6); 
  stop();

  clrscrn();
  printf(" A :");
  p_mZ(A, S8,P0, S2,P0,C6); 
  
  printf(" Q * R  :");  
  mul_mZ(Q,R, T);
  p_mZ(T, S8,P0, S2,P0, C6); 
  
  f_mZ(A);
  f_mZ(Q);
  f_mZ(R);
  f_mZ(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R1)+R2,rp_I(R2));
} while(stop_w());

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


Le travail précédent nous conduit à la factorisation QR : QRuv_mZ(A,Q,R);


Exemple de sortie écran :
 A :
     -51-88i      +58-16i      -52-28i 
     +16+20i      -55+35i      +84+33i 
     +41-34i      -65+79i      -63-61i 
     -30-56i      -65-37i      -75-28i 
     +99-58i      -84+52i       -2-78i 

 Q :
   -0.2895  -0.4995i    +0.1019  -0.2891i    +0.2317  -0.0866i 
   +0.0908  +0.1135i    -0.2712  +0.2556i    +0.7506  +0.2560i 
   +0.2327  -0.1930i    -0.3302  +0.3420i    -0.4482  -0.2897i 
   -0.1703  -0.3179i    -0.5636  -0.3543i    -0.0492  -0.0313i 
   +0.5619  -0.3292i    -0.3116  +0.0302i    +0.0088  +0.1468i 

 R :
 +176.1789  +0.0000i   -81.6840 +36.0713i   +83.7501-114.3213i 
   -0.0000  +0.0000i  +160.3639  -0.0000i   +38.8539  +6.9514i 
   +0.0000  -0.0000i    +0.0000  +0.0000i  +100.8891  -0.0000i 

 Press return to continue. 
 

 A :
     -51-88i      +58-16i      -52-28i 
     +16+20i      -55+35i      +84+33i 
     +41-34i      -65+79i      -63-61i 
     -30-56i      -65-37i      -75-28i 
     +99-58i      -84+52i       -2-78i 

 Q * R  :
     -51-88i      +58-16i      -52-28i 
     +16+20i      -55+35i      +84+33i 
     +41-34i      -65+79i      -63-61i 
     -30-56i      -65-37i      -75-28i 
     +99-58i      -84+52i       -2-78i 


 Press return to continue
 Press X      to stop