Aller au contenu

Mathc matrices/c25h

Un livre de Wikilivres.


Application


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

c04a.c
/* ------------------------------------ */
/*  Save as :   c04a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RCQ RC4
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **u      =   r_mR(i_mR(RCQ,C1) ,9.);

double **Q      = r_Q_mR(i_mR(RCQ,RCQ), 9);
double **Qu     =        i_mR(RCQ,C1);

  clrscrn();
    
  printf(" Q :             an orthogonal matrix ");
  p_mR(Q,S3,P5,C6);
  
  printf(" u :");
  p_mR(u,S3,P5,C6);


  printf(" ||Q*u||     = ||u|| \n\n ");
  printf("   %.3f   = %.3f           \n\n ",
  
  norm_R(mul_mR(Q,u,Qu)),  norm_R(u));
   
  f_mR(u); 
  f_mR(Qu);
  f_mR(Q);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
 Vérifions que multiplier un vecteur par une  matrice orthonormale ne change pas sa norme  :
Exemple de sortie écran :
 --------------------------------
 Q :             an orthogonal matrix 
+0.41036 +0.51736 +0.12756 +0.11981 -0.39152 -0.24662 
-0.36477 +0.39352 -0.11693 +0.04432 +0.24780 -0.30983 
+0.36477 +0.34609 -0.24873 -0.11938 +0.38439 +0.70654 
-0.41036 -0.23289 +0.29318 +0.39570 +0.18627 +0.31851 
+0.27358 -0.50849 -0.67285 +0.20042 -0.11563 -0.11490 
-0.31917 +0.16654 -0.45427 -0.35856 +0.31337 -0.25168 
+0.41036 -0.05157 +0.17607 +0.39655 +0.67762 -0.38740 
+0.22798 -0.33840 +0.36353 -0.69776 +0.17923 -0.12612 

+0.30133 -0.47792 
-0.64241 -0.35548 
-0.07555 -0.13558 
+0.29224 -0.55971 
-0.11771 -0.36507 
+0.60966 -0.04735 
+0.09666 +0.14868 
-0.10257 -0.39489 

 u :
+1.00000 
+7.00000 
+3.00000 
-8.00000 
+1.00000 
+3.00000 
-4.00000 
+5.00000 

 ||Q*u||     = ||u|| 

    13.191   = 13.191           

 
 Press return to continue
 Press X      to stop