Aller au contenu

Mathc complexes/a80

Un livre de Wikilivres.

Matrices Orthonormales ... ... Matrices Aléatoire

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),99);
double **Q_T = ctranspose_mZ(Q,i_mZ(r,r));
double **Ide =                 i_mZ(r,r);

double x, y;

  clrscrn();
    
  printf(" Q :      An orthonormal matrix ");
  p_mZ(Q,S9,P4, S9,P4, C4);

  printf(" Ide = Q * Q_T :  "); 
  mul_mZ(Q,Q_T, Ide);
  p_mZ(Ide,S9,P4, S9,P4, C4);
    
  printf(" det(Q) = ");
  p_Z(det_Z(Q), S4,P4, S5,P4);
  
  x = det_Z(Q).r;
  y = det_Z(Q).i;
  
  printf("\n\n ||det_Z(Q)|| = %.4f \n\n\n", sqrt(x*x+y*y));

  f_mZ(Q);
  f_mZ(Q_T);
  f_mZ(Ide);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R3)+R1);

} while(stop_w());

  return 0;
}

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


 Matrices orthonormales : 


Exemple de sortie écran :

 ------------------------------------------
 Q :      An orthonormal matrix 
  -0.7031  +0.0933i   -0.1248  +0.3384i   -0.4273  +0.4056i   -0.1346  -0.0410i 
  -0.1004  +0.5094i   -0.1852  +0.0686i   -0.1972  -0.3962i   +0.6926  -0.1262i 
  -0.4448  +0.0359i   +0.2554  -0.5685i   +0.2408  -0.0428i   -0.0302  -0.5930i 
  -0.1076  -0.1291i   -0.3313  +0.5768i   +0.6139  -0.1427i   -0.0389  -0.3612i 

 Ide = Q * Q_T :  
  +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 

 det(Q) = +0.1649+0.9863i 

 ||det_Z(Q)|| = 1.0000 



 Press return to continue
 Press X      to stop