Mathc matrices/cq051

Un livre de Wikilivres.


Application


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

cq1.c
/* ------------------------------------ */
/*  Save as :   cq1.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **Q = r_Q_mR(i_mR(r,r), 9);

  clrscrn();
    
  printf(" Q :      An orthonormal matrix\n\n"
         "          det(Q) = 1 or -1\n\n");
  p_mR(Q,S3,P3,C6);
  
  printf(" det(Q) = %.0f\n\n",det_R(Q));   
  
  f_mR(Q);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

} while(stop_w());

  return 0;
}

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


La création de matrices aléatoires orthogonales :  r_Q_mR(U,Q); 



Exemple de sortie écran :
 Q :      An orthogonal matrix (orthonormal !!)

          det(Q) = 1 or -1


+0.150 +0.082 +0.870 -0.449 +0.108 
+0.600 +0.329 -0.153 +0.133 +0.701 
-0.375 +0.373 -0.375 -0.734 +0.203 
-0.525 -0.481 +0.127 +0.145 +0.675 
-0.450 +0.717 +0.250 +0.469 +0.013 

 det(Q) = -1


 Press return to continue
 Press X      to stop