< Mathc matrices


Sommaire


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

cq3.c
'
/* ------------------------------------ */
/*  Save as :   cq3.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U   = r_mR(i_mR(r,r),9.);
double **V   = r_mR(i_mR(r,r),9.);
double **A   =      i_mR(r,r);
double **B   =      i_mR(r,r);
double **AB  =      i_mR(r,r);
double **ABT =      i_mR(r,r);
double **T   =      i_mR(r,r);

  clrscrn();
  
  r_Quv_mR(U,A);    
  printf(" A :                an orthogonal matrix ");
  p_mR(A,3,3,6);
  
  r_Quv_mR(V,B);    
  printf(" B :                an orthogonal matrix ");
  p_mR(B,3,3,6);
   
  printf("   A * B  = AB  :   AB is an orthogonal matrix");
  mul_mR(A,B,AB);
  p_mR(AB,3,3,6);    

  printf(" AB * ABT = id :    inv(AB) = ABT ");
  transpose_mR(AB,ABT);
  mul_mR(AB,ABT,T);
  p_mR(T,3,3,6);    
  
  f_mR(U);
  f_mR(V);
  f_mR(A);
  f_mR(B);
  f_mR(AB);
  f_mR(ABT);
  f_mR(T);

}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

} while(stop_w());

  return 0;
}

/* ------------------------------------ */
/* ------------------------------------ */


Le produit de deux matrices orthogonales est orthogonale :  r_Quv_mR(U,Q); 



Exemple de sortie écran :
 A :                an orthogonal matrix 
+0.185 -0.919 -0.349 
+0.740 +0.364 -0.566 
-0.647 +0.154 -0.747 

 B :                an orthogonal matrix 
+0.424 +0.356 -0.833 
-0.318 -0.803 -0.505 
+0.848 -0.479 +0.227 

   A * B  = AB  :   AB is an orthogonal matrix
+0.074 +0.970 +0.230 
-0.282 +0.242 -0.928 
-0.956 +0.004 +0.292 

 AB * ABT = id :    inv(AB) = ABT 
+1.000 +0.000 +0.000 
+0.000 +1.000 +0.000 
+0.000 +0.000 +1.000 


 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.