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 rc)
{
double **B     =         r_mR(   i_mR(rc,rc),9.);
double **B_T   = transpose_mR(B, i_mR(rc,rc));
 
double **U   =                   i_mR(rc,rc);
double **U_T =                   i_mR(rc,rc);
double **V   =                   i_mR(rc,rc);
double **V_T =                   i_mR(rc,rc);

double **S   =                   i_mR(rc,rc);
double **T   =                   i_mR(rc,rc);

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

  clrscrn(); 
  svd_U_Rn_mR(B_T,U);    
  svd_V_Rn_mR(B_T,V); 
            
  printf(" U :");
  p_mR(U, S8,P5,C10);   

  printf(" S : U_T * B * V");   
  transpose_mR(U,U_T);   
        mul_mR(U_T,B,T);
        mul_mR(T,V,S);        
          p_mR(S, S10,P4,C6);
              
  printf(" V:");
  p_mR(V,S8,P5,C10);
  stop();  

  clrscrn();   
  printf(" B :");
  p_mR(B, S10,P3,C10); 
  
  printf(" B = U * S * V_T ");
  transpose_mR(V,V_T);
        mul_mR(U,S,T);
        mul_mR(T,V_T,B);
          p_mR(B, S10,P3,C10);  
       
  f_mR(B_T);
  f_mR(B);
  
  f_mR(U);
  f_mR(U_T);
  f_mR(V); 
  f_mR(V_T);
    
  f_mR(S);   
  f_mR(T); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

} while(stop_w());

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


Cet version fonctionne quand le nombre de lignes est supérieur ou égal au nombre de colonnes..

 svd_U_Rn_mR(B_T,U);    
 svd_V_Rn_mR(B_T,V); 


Exemple de sortie écran :
 Copy/Past into the octave windows 


 B=[
+4.00,-5.00,+8.00,-5.00;
+4.00,-7.00,-3.00,-1.00;
-4.00,-9.00,+2.00,+3.00;
-4.00,+1.00,+2.00,+9.00]

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


 Press return to continue. 


 U :
+0.72402 +0.02427 -0.64840 +0.23407 
+0.43152 +0.14242 +0.69039 +0.56291 
+0.24106 +0.80909 +0.11010 -0.52453 
-0.48112 +0.56964 -0.30137 +0.59431 

 S : U_T * B * V
  -13.8667    +0.0000    -0.0000    -0.0000 
   +0.0000   -12.0143    -0.0000    -0.0000 
   +0.0000    -0.0000    -8.2216    +0.0000 
   -0.0000    +0.0000    +0.0000    +3.5745 

 V:
-0.40258 +0.40354 -0.11349 +0.81376 
+0.67005 +0.65177 +0.35067 +0.05718 
-0.28972 -0.21011 +0.92937 +0.09048 
+0.55229 -0.60680 -0.02063 +0.57126 

 Press return to continue. 


 B :
    +4.000     -5.000     +8.000     -5.000 
    +4.000     -7.000     -3.000     -1.000 
    -4.000     -9.000     +2.000     +3.000 
    -4.000     +1.000     +2.000     +9.000 

 B = U * S * V_T 
    +4.000     -5.000     +8.000     -5.000 
    +4.000     -7.000     -3.000     -1.000 
    -4.000     -9.000     +2.000     +3.000 
    -4.000     +1.000     +2.000     +9.000 


 Press   return to continue
 Press X return to stop