Aller au contenu

Mathc matrices/02f

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 R3
#define   CA C5
/* ------------------------------------ */
#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(RA,RA);    

  clrscrn();
  printf(" A :");
  p_mR(A,S13,P2,C7);   
  
  printf(" PseudoInverse = V * invS_T * U_T ");
  pseudo_Cn_mR(A,Pinv,FACTOR_E); 
  pE_mR(Pinv,S13,P4,C10);
  
  printf(" Ide =  A * Pinv ");
  mul_mR(A,Pinv,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..

pseudo_Rn_mR(A,Pinv,FACTOR_E); 



Exemple de sortie écran :
 A :
   -995258.00    +139608.00    -208353.00    +886038.00    -300740.00 
    +58108.00    -288523.00    +542660.00    +329472.00    +356319.00 
   +854494.00     +23903.00    +720186.00    -502256.00    -866761.00 

 PseudoInverse = V * invS_T * U_T 
  -4.1469e-07   +8.7272e-08   +1.6338e-07 
  +9.9410e-08   -4.6006e-07   +5.4422e-08 
  +1.6272e-07   +9.1489e-07   +4.2155e-07 
  +4.9593e-07   +5.5869e-07   +4.7251e-08 
  -5.5825e-07   +5.0979e-07   -6.6827e-07 

 Ide =  A * Pinv 
  +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