< Mathc complexes


Sommaire


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),9.);
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,P2,S2,P2,C6);  
  
  QRuv_mZ(A,Q,R);
    
  printf(" Q :");
  p_mZ(Q,S8,P2,S2,P2,C6); 
  
  printf(" R :");
  p_mZ(R,S8,P2,S2,P2,C6); 
  stop();

  clrscrn();
  printf(" A :");
  p_mZ(A,S8,P2,S2,P2,C6); 
  
  printf(" Q * R  :");  
  mul_mZ(Q,R, T);
  p_mZ(T,S8,P2,S2,P2,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(1)+R2,rp_I(2));
} 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 :
   -7.00-5.00i    +4.00-3.00i    -5.00-5.00i 
   -9.00+6.00i    -9.00-5.00i    +2.00+8.00i 
   -5.00+6.00i    -9.00+6.00i    +2.00-5.00i 
   +8.00-3.00i    +6.00+2.00i    -9.00+4.00i 
   +2.00-1.00i    -5.00-9.00i    +8.00+8.00i 

 Q :
   -0.39-0.28i    +0.32+0.21i    +0.02-0.28i 
   -0.50+0.33i    -0.10-0.21i    -0.10+0.41i 
   -0.28+0.33i    -0.23+0.38i    -0.22+0.13i 
   +0.44-0.17i    +0.04-0.05i    -0.72+0.35i 
   +0.11-0.06i    -0.43-0.64i    +0.08-0.17i 

 R :
  +18.17+0.00i    +8.81+9.63i    -1.43-1.76i 
   -0.00+0.00i   +14.95-0.00i   -16.01+0.78i 
   -0.00-0.00i    +0.00-0.00i   +10.48+0.00i 

 Press return to continue. 


 A :
   -7.00-5.00i    +4.00-3.00i    -5.00-5.00i 
   -9.00+6.00i    -9.00-5.00i    +2.00+8.00i 
   -5.00+6.00i    -9.00+6.00i    +2.00-5.00i 
   +8.00-3.00i    +6.00+2.00i    -9.00+4.00i 
   +2.00-1.00i    -5.00-9.00i    +8.00+8.00i 

 Q * R  :
   -7.00-5.00i    +4.00-3.00i    -5.00-5.00i 
   -9.00+6.00i    -9.00-5.00i    +2.00+8.00i 
   -5.00+6.00i    -9.00+6.00i    +2.00-5.00i 
   +8.00-3.00i    +6.00+2.00i    -9.00+4.00i 
   +2.00-1.00i    -5.00-9.00i    +8.00+8.00i 


 Press return to continue
 Press X      to stop
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.