Aller au contenu

Mathc complexes/a331

Un livre de Wikilivres.


Les matrices orthonormales, orthogonales


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

c00b.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "w_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A = r_Q_mZ(i_mZ(r,r), 9);
double **B = r_Q_mZ(i_mZ(r,r), 9);
double **AB  =      i_mZ(r,r);
double **ABT =      i_mZ(r,r);
double **T   =      i_mZ(r,r);

  clrscrn();
  printf(" A :                an orthonormal matrix ");
  p_mZ(A, S10,P4, S8,P4, C4);; 
  printf(" B :                an orthonormal matrix ");
  p_mZ(B, S10,P4, S8,P4, C4);
  stop();

  clrscrn();
  printf("   A * B  = AB  :   AB is an orthonormal matrix");
  mul_mZ(A,B,AB);
  p_mZ(AB, S10,P4, S8,P4, C4);   

  printf(" AB * ABT = id :    inv(AB) = ABT ");
  ctranspose_mZ(AB,ABT);
  mul_mZ(AB,ABT,T);
  p_mZ(T, S10,P4, S8,P4, C4); 
  
  f_mZ(A);
  f_mZ(B);
  f_mZ(AB);
  f_mZ(ABT);
  f_mZ(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(R4);

} while(stop_w());

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


Exemple de sortie écran :
 A :                an orthonormal matrix 
   -0.3796 +0.4339i    +0.1007 -0.4840i    -0.0539 +0.4905i    -0.2968 -0.3028i 
   -0.2169 +0.3796i    +0.1598 +0.3731i    -0.1701 -0.5313i    -0.5769 +0.0078i 
   +0.2169 +0.4881i    +0.4279 -0.1494i    +0.3129 -0.3383i    +0.4773 -0.2629i 
   +0.4339 +0.0542i    +0.2065 +0.5855i    +0.0061 +0.4826i    -0.1434 -0.4122i 

 B :                an orthonormal matrix 
   -0.6495 +0.3608i    +0.1997 -0.0811i    -0.4938 -0.1318i    -0.0055 +0.3745i 
   +0.3608 -0.1443i    +0.3444 -0.6049i    +0.0525 -0.4162i    +0.2164 +0.3763i 
   +0.4330 -0.1443i    -0.2744 +0.1653i    -0.4567 +0.1172i    -0.4608 +0.5045i 
   -0.0722 -0.2887i    +0.4353 -0.4207i    -0.2335 +0.5348i    -0.3429 -0.2948i 

 Press return to continue. 


   A * B  = AB  :   AB is an orthonormal matrix
   +0.0379 -0.2803i    -0.6216 -0.2607i    +0.2469 -0.5499i    -0.1665 -0.2733i 
   +0.0089 -0.2528i    +0.1549 +0.4890i    +0.5913 -0.2934i    +0.2997 +0.3839i 
   -0.2079 -0.6649i    +0.2070 -0.4011i    -0.1566 +0.0523i    -0.2498 +0.4704i 
   -0.1787 +0.5820i    +0.1991 -0.1981i    +0.2420 -0.3393i    -0.5169 +0.3309i 

 AB * ABT = id :    inv(AB) = ABT 
   +1.0000 +0.0000i    +0.0000 +0.0000i    +0.0000 -0.0000i    -0.0000 +0.0000i 
   +0.0000 -0.0000i    +1.0000 +0.0000i    -0.0000 +0.0000i    -0.0000 +0.0000i 
   +0.0000 +0.0000i    -0.0000 -0.0000i    +1.0000 +0.0000i    -0.0000 -0.0000i 
   -0.0000 -0.0000i    -0.0000 -0.0000i    -0.0000 +0.0000i    +1.0000 +0.0000i 


 Press   return to continue
 Press X return to stop