< Mathc matrices


Sommaire


Installer ce fichier dans votre répertoire de travail.


ca56.c
'
/* ------------------------------------ */
/*  Save as :   ca56.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double ab[R5*C6]={
+98,-85,+20,-99,+24,-9,
-43,-81,+52,-3,-5,-95,
+76,+98,-41,+62,+54,-7,
-33,-81,+50,-79,+20,+28,
-61,+48,+12,-27,-37,+16
};

int r = R5;
int c = C6;

double **A         = ca_A_mR(ab,i_mR(r,c));
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);  
  
  stop();
      
  f_mR(A);
  f_mR(A_T); 
  f_mR(SvdValue); 
  f_mR(svdU);
  f_mR(svdV); 
}
/* ------------------------------------ */
int main(void)
{

  fun();

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




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


 a=[
+98,-85,+20,-99,+24,-9;
-43,-81,+52,-3,-5,-95;
+76,+98,-41,+62,+54,-7;
-33,-81,+50,-79,+20,+28;
-61,+48,+12,-27,-37,+16]

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


 Press return to continue. 

 ------------------------------------
 svdU :
 -0.482934  +0.744581  -0.081071  +0.452091  -0.037616 
 -0.416344  -0.275621  +0.802780  +0.175976  +0.274350 
 +0.567062  +0.438970  +0.224269  -0.022131  +0.659515 
 -0.519431  -0.028826  -0.359270  -0.524362  +0.570377 
 +0.045432  -0.419651  -0.411826  +0.699429  +0.403767 

 SvdValue :
+231.980731 
+161.948563 
+115.726339 
+49.695642 
+43.856142 

 svdV :
 +0.120880  +0.893693  -0.099867  -0.195082  -0.200941  +0.313518 
 +0.752649  -0.097274  +0.231775  -0.426500  +0.428393  +0.070104 
 -0.344789  -0.147674  -0.069325  -0.025657  +0.452339  +0.805753 
 +0.534638  -0.197981  -0.510031  +0.485296  -0.277514  +0.319856 
 +0.038982  +0.357539  -0.122730  +0.555197  +0.679664  -0.292226 
 +0.112563  +0.054884  +0.810128  +0.485413  -0.180374  +0.244643 

 Press return to continue.
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.