Aller au contenu

Mathc matrices/02x

Un livre de Wikilivres.


Application

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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A      =  rdefinite_positive_mR(       i_mR(r,r), 99);
double **invA   =                 inv_mR(A,     i_mR(r,r));
double **EValue =                 eigs_mR(invA, i_mR(r,C1));

  clrscrn();  
  printf(" A = Q D QT: ");
  p_mR(A,S12,P6,C6);
  
  printf(" invA  ");
  p_mR(invA,S12,P6,C6);
  
  printf(" InvA : EValue are positives");
  p_mR(EValue,S9,P3,C1);    
  
  f_mR(A);
  f_mR(invA);
  f_mR(EValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

} while(stop_w());

  return 0;
}

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


La matrice inverse d'une matrice définie positive est définie positive.

Exemple de sortie écran :

 A = Q D QT: 
  +10.480596    +5.994009    -4.243178   -11.098114 
   +5.994009   +11.662933    +7.099937    +9.844228 
   -4.243178    +7.099937   +74.036444    -5.254716 
  -11.098114    +9.844228    -5.254716   +75.820026 

 invA  
   +0.531390    -0.442573    +0.082904    +0.140990 
   -0.442573    +0.473174    -0.080093    -0.131768 
   +0.082904    -0.080093    +0.027674    +0.024452 
   +0.140990    -0.131768    +0.024452    +0.052629 

 InvA : EValue are positives
   +1.000 
   +0.059 
   +0.014 
   +0.012 


 Press   return to continue
 Press X return to stop