< Mathc matrices


Sommaire


Installer ce fichier dans votre répertoire de travail.


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

double **SvdValue =      i_mR(r,C1);

double **svdU =          i_mR(r,r);
double **svdV =          i_mR(c,c);

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

  clrscrn();  
  
  svdU_mR(A,svdU); 
  svdV_mR(A,svdV);   
  svduv_mR(transpose_mR(A,A_T),SvdValue);   
     
  printf(" svdU :");
  p_mR(svdU,S10,P6,C6);  
  
  printf(" SvdValue :");
  p_mR(SvdValue,S10,P6,C6);   
     
  printf(" svdV :");
  p_mR(svdV,S10,P6,C6);  
    
  f_mR(A);
  f_mR(A_T); 
  f_mR(SvdValue); 
  f_mR(svdU);
  f_mR(svdV); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

int i;

do
{
  i = rp_I(R4)+R1;
  
  fun(i,i+C1);
  
} while(stop_w());

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




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


 a=[
+60,-93,-27,+84;
+2,+52,+8,-99;
-59,-29,+82,+14]

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


 Press return to continue. 


 ------------------------------------ 
 svdU :
 +0.797467  -0.176804  +0.576877 
 -0.603349  -0.240288  +0.760416 
 -0.004172  +0.954464  +0.298296 

 SvdValue :
+173.398497 
+110.379168 
+39.980003 

 svdV :
 +0.270403  +0.610642  -0.463582  +0.582314 
 -0.607949  +0.215002  +0.569249  +0.510027 
 -0.153984  -0.734898  -0.374385  +0.544104 
 +0.730458  -0.202026  +0.566466  +0.323625 


 Press return to continue
 Press X      to stop
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.