Application


Installer ce fichier dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r,int c)
{
double **A   = r_mR( i_mR(r,c),9.);
double **A_T =       i_mR(c,r);

double **S   =       i_mR(r,C1);
double **U   =       i_mR(r,r);
double **V   =       i_mR(c,c);

  clrscrn();  
  printf(" Copy/Past into the octave windows \n\n\n");
  p_Octave_mR(A,"A",P2);
  printf(" [U, S, V] =svd (A,10)\n\n\n");
  stop();

  clrscrn(); 
  transpose_mR(A,A_T);
   
  svd_U_Cn_mR(A,U); 
  svd_V_Cn_mR(A,V); 
      svds_mR(A_T,S);
  
  printf(" U :");
  p_mR(U,S5,P5,C10);   
    
  printf(" S :");
  p_mR(S,S5,P5,C10);
   
  printf(" V:");
  p_mR(V,S5,P5,C10);  
    
  f_mR(A);
  f_mR(A_T); 
  f_mR(S); 
  f_mR(U);
  f_mR(V); 
}
/* ------------------------------------ */
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=[
+4.00,+3.00,-8.00,-7.00,-7.00,-7.00;
-5.00,-1.00,-1.00,-1.00,-6.00,-9.00;
-4.00,+9.00,+2.00,-7.00,+1.00,+9.00]

 [U, S, V] =svd (A,10)


 Press return to continue. 


 U :
+0.65849 +0.60725 -0.44456 
+0.53320 +0.04043 +0.84502 
-0.53111 +0.79348 +0.29717 

 S :
+18.31706 
+14.43899 
+8.30667 

 V:
-0.11423 +0.06559 +0.86581 +0.12315 +0.41886 -0.08329 
+0.18222 -0.61795 -0.05969 +0.75007 +0.00000 -0.00000 
+0.37470 +0.22934 -0.39797 +0.00000 +0.77954 +0.00000 
+0.07779 +0.68187 -0.02248 +0.61153 -0.37377 -0.40456 
+0.45530 +0.25624 +0.19997 +0.00000 +0.00000 +0.79722 
+0.77459 -0.17499 +0.21895 -0.21970 -0.27778 -0.44026 


 Press return to continue
 Press X      to stop