Aller au contenu

Mathc complexes/c05l

Un livre de Wikilivres.


Application


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

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

/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U           = r_mZ(i_mZ(r,r),9.);
double **Orth        =      i_mZ(r,r);
double **conj_Orth_T =      i_mZ(r,r);

  clrscrn();
  printf(" U :");
  p_mZ(U, S8,P0, S1,P0, C6); 

  orth_mZ(U,Orth);

  printf(" Orth :");
  p_mZ(Orth, S8,P4, S1,P4, C6);  
  stop();
  
  clrscrn();
  printf(" Orth :");
  p_mZ(Orth, S8,P4, S1,P4, C6); 
  
  printf(" conj_Orth_T :");
  ctranspose_mZ(Orth,conj_Orth_T);
  p_mZ(conj_Orth_T, S8,P4, S1,P4, C6); 
  
  printf(" conj_Orth_T * Orth  :");  
  mul_mZ(conj_Orth_T,Orth, U);
  p_mZ(U, S8,P0, S1,P0, C6);   
    
  f_mZ(U);
  f_mZ(Orth);
  f_mZ(conj_Orth_T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

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


Nous voyons la mise en place de algorithme de gram schmidt : orthuv_mZ(U,Orth);



Exemple de sortie écran :
 U :
   -5.00+2.00i    -3.00-1.00i    +8.00+8.00i 
   -9.00-7.00i    +4.00+4.00i    +6.00+4.00i 
   +8.00-9.00i    -1.00-3.00i    -5.00+6.00i 

 Orth :
   -5.00+2.00i    -3.72-1.28i    +2.75+5.22i 
   -9.00-7.00i    +3.74+2.38i    +2.11+2.08i 
   +8.00-9.00i    +0.73-3.16i    +4.23-0.32i 

 Press return to continue. 


 Orth :
   -5.00+2.00i    -3.72-1.28i    +2.75+5.22i 
   -9.00-7.00i    +3.74+2.38i    +2.11+2.08i 
   +8.00-9.00i    +0.73-3.16i    +4.23-0.32i 

 conj_Orth_T :
   -5.00-2.00i    -9.00+7.00i    +8.00+9.00i 
   -3.72+1.28i    +3.74-2.38i    +0.73+3.16i 
   +2.75-5.22i    +2.11-2.08i    +4.23+0.32i 

 conj_Orth_T * Orth  :
 +304.00+0.00i    +0.00-0.00i    +0.00+0.00i 
   +0.00+0.00i   +45.67+0.00i    +0.00+0.00i 
   +0.00+0.00i    +0.00-0.00i   +61.55+0.00i 


 Press return to continue
 Press X      to stop