< Mathc matrices


Sommaire


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

c05m.c
'
/* ------------------------------------ */
/*  Save as :   c05m.c                   */
/* ------------------------------------ */
#include "v_a.h"

/* ------------------------------------ */
void fun(int r)
{
double **U      = r_mR(i_mR(r,r),9.);
double **T      =      i_mR(r,r);
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, T);  
  p_mR(T,15,9,6); 
  
  printf(" NormT * Norm  :");
  Normalizeuv_mR(Orth);  
  transpose_mR(Orth,Orth_T);
  mul_mR(Orth_T,Orth, T);  
  p_mR(T,15,9,6);
   
  f_mR(U);
  f_mR(T);
  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 ici le produit scalaire : dotuv_R(u,v);



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

 Orth :
-9.00000 +5.95618 -2.58326 -1.70410 
-9.00000 +1.95618 +1.84456 +4.00360 
-5.00000 -8.13546 -2.59999 +1.31400 
+8.00000 +3.81673 -2.45603 +3.40820 

 OrthT * Orth  :
 +251.000000000    +0.000000000    +0.000000000    +0.000000000 
   +0.000000000  +120.055776892    -0.000000000    -0.000000000 
   +0.000000000    -0.000000000   +22.867657795    +0.000000000 
   +0.000000000    -0.000000000    +0.000000000   +32.275213541 

 NormT * Norm  :
   +1.000000000    +0.000000000    +0.000000000    -0.000000000 
   +0.000000000    +1.000000000    -0.000000000    -0.000000000 
   +0.000000000    -0.000000000    +1.000000000    +0.000000000 
   -0.000000000    -0.000000000    +0.000000000    +1.000000000 


 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.