Aller au contenu

Mathc matrices/02e

Un livre de Wikilivres.


Application


Installer ce fichier dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R5
#define   CA C3
/* ------------------------------------ */
#define FACTOR_E        +1.E-6         
/* ------------------------------------ */
void fun(void)
{
double **A    =  r_mR(i_mR(RA,CA),999999);
double **Pinv =       i_mR(CA,RA); 
double **Ide  =       i_mR(CA,CA);         

  clrscrn();
  printf(" A :");
  p_mR(A,S13,P2,C7);
  
  printf(" Pinv = V * invS_T * U_T ");
  Pinv_Rn_mR(A,Pinv,FACTOR_E);  
  pE_mR(Pinv,S13,P4,C10); 
  
  printf(" Ide = Pinv * A ");   
  mul_mR(Pinv,A,Ide); 
  p_mR(Ide,S7,P2,C10); 
      
  f_mR(A);
  f_mR(Pinv);
  f_mR(Ide); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun();


} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Cet version fonctionne quand il y a plus de lignes que de colonnes..

Pinv_Rn_mR(A,Pinv,FACTOR_E); 


Exemple de sortie écran :

 A :
   +332623.00     -10861.00    -998937.00 
   +397128.00    +439904.00    +656809.00 
   +546899.00    +583289.00    -131735.00 
   -902395.00    +322520.00    +504462.00 
    +27176.00    -424264.00    +918733.00 

 Pinv = V * invS_T * U_T 
  +9.1104e-08   +3.6724e-07   +3.1735e-07   -7.1241e-07   +2.7319e-07 
  -3.6052e-08   +4.5539e-07   +6.4052e-07   +5.5787e-07   -5.7924e-07 
  -3.7200e-07   +3.4159e-07   +2.0821e-08   +3.8521e-08   +4.2161e-07 

 Ide = Pinv * A 
  +1.00   -0.00   -0.00 
  +0.00   +1.00   +0.00 
  -0.00   -0.00   +1.00 


 Press   return to continue
 Press X return to stop