Aller au contenu

Mathc matrices/c12fn16

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"
/* ------------------------------------ */
#define FACTOR_E        +1.E-5         
/* ------------------------------------ */
void fun(int r,int c)
{
double **A    = r_mR( i_mR(r,c),99999.);
double **Pinv =       i_mR(c,r);     
double **Ide  =       i_mR(r,r);    

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n\n");
  p_Octave_mR(A,"A",P2);
  printf("pinv(A)\n\n\n");
  stop();

  clrscrn();
  printf(" PseudoInverse = V * invS_T * U_T ");
  pseudo_Cn_mR(A,Pinv,FACTOR_E); 
  pE_mR(Pinv,S12,P4,C10);
  
  printf(" Ide =  A * PseudoInverse ");
  mul_mR(A,Pinv,Ide); 
  p_mR(Ide,S10,P6,C10);   
    
  f_mR(A); 
  f_mR(Pinv); 
  f_mR(Ide); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

int i;

do
{
  i = rp_I(R3)+R1;
  
  fun(i,i+C3);

} while(stop_w());

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


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

 svd_U_Cn_mR(A,U); 
 svd_V_Cn_mR(A,V);  


Exemple de sortie écran :

 Copy/Past into the octave windows 


 A=[
-3916.00,-39300.00,-43369.00,-35190.00,-11209.00,+2016.00;
+61137.00,-21528.00,-86747.00,-44140.00,-89889.00,+14942.00;
-51826.00,+92577.00,+60927.00,-36306.00,+36606.00,-59099.00]

pinv(A)


 Press return to continue. 


 PseudoInverse = V * invS_T * U_T 
 -9.8882e-06  +4.6960e-06  -2.0547e-06 
 -1.0134e-05  +5.2154e-06  +5.0408e-06 
 -6.0251e-06  -1.9387e-06  +1.6947e-07 
 -1.0751e-05  -1.9359e-06  -5.6253e-06 
 +6.3132e-06  -6.4874e-06  -6.7231e-07 
 -2.9003e-06  -7.7598e-07  -4.0086e-06 

 Ide =  A * PseudoInverse 
 +1.000000  +0.000000  +0.000000 
 -0.000000  +1.000000  -0.000000 
 +0.000000  +0.000000  +1.000000 


 Press   return to continue
 Press X return to stop