< Mathc matrices


Sommaire


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

c05l.c
'
/* ------------------------------------ */
/*  Save as :   c05l.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U      = r_mR(i_mR(r,r),9.);
double **Orth   =      i_mR(r,r);
double **Orth_T =      i_mR(r,r);

  clrscrn();
  
  printf(" U :");
  p_mR(U,3,0,6);

  orthuv_mR(U,Orth);
  
  printf(" Orth :");
  p_mR(Orth,3,5,6);
  
  printf(" OrthT * Orth  :");
  transpose_mR(Orth,Orth_T);
  mul_mR(Orth_T,Orth, U);  
  p_mR(U,15,9,6);
    
  f_mR(U);
  f_mR(Orth);
  f_mR(Orth_T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(2)+R2);

} while(stop_w());

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


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



Exemple de sortie écran :
 U :
 +4  +2  +4 
 -5  -7  -9 
 -5  -5  -9 

 Orth :
+4.00000 -2.12121 -0.61069 
-5.00000 -1.84848 +0.61069 
-5.00000 +0.15152 -1.09924 

 OrthT * Orth  :
  +66.000000000    +0.000000000    +0.000000000 
   +0.000000000    +7.939393939    -0.000000000 
   +0.000000000    -0.000000000    +1.954198473 


 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.