Aller au contenu

Mathc complexes/a333

Un livre de Wikilivres.


Les matrices orthonormales, orthogonales


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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **Q   = r_Q_mZ(i_mZ(r,r), 9);
double **QT  =        i_mZ(r,r);
double **T   =        i_mZ(r,r);

  clrscrn();  
  printf(" Q :                 An orthonormal matrix");
  p_mZ(Q, S8,P4, S8,P4, C4);
  
  printf(" QT :                QT = inv(Q)");
  ctranspose_mZ(Q,QT);
  p_mZ(QT, S8,P4, S8,P4, C4);
  stop();

  clrscrn();
  printf(" Q * QT :            QT = inv(Q)");
  mul_mZ(Q,QT,T);
  p_mZ(T, S8,P4, S8,P4, C4);   

  printf(" QT * Q :");
  mul_mZ(QT,Q,T);
  p_mZ(T, S8,P4, S8,P4, C4);  
   
  f_mZ(Q);
  f_mZ(QT);
  f_mZ(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(R4);

} while(stop_w());

  return 0;
}

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


Exemple de sortie écran :
 Q :                 An orthonormal matrix
 -0.3114 +0.3114i  -0.4180 +0.4256i  -0.5557 +0.2866i  -0.1422 -0.1975i 
 -0.4671 -0.5449i  -0.1271 +0.3908i  +0.5024 +0.1623i  +0.0044 -0.1929i 
 +0.1557 +0.1557i  -0.4572 +0.4061i  +0.2146 -0.3086i  +0.2488 +0.6119i 
 -0.4671 -0.1557i  +0.2718 -0.1658i  -0.2741 +0.3375i  +0.2599 +0.6322i 

 QT :                QT = inv(Q)
 -0.3114 -0.3114i  -0.4671 +0.5449i  +0.1557 -0.1557i  -0.4671 +0.1557i 
 -0.4180 -0.4256i  -0.1271 -0.3908i  -0.4572 -0.4061i  +0.2718 +0.1658i 
 -0.5557 -0.2866i  +0.5024 -0.1623i  +0.2146 +0.3086i  -0.2741 -0.3375i 
 -0.1422 +0.1975i  +0.0044 +0.1929i  +0.2488 -0.6119i  +0.2599 -0.6322i 

 Press return to continue. 


 Q * QT :            QT = inv(Q)
 +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 

 QT * Q :
 +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