< Mathc matrices


Sommaire


Installer ce fichier dans votre répertoire de travail.


ca45.c
'
/* ------------------------------------ */
/*  Save as :   ca45.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double ab[R4*C5]={
+84,-39,+82,+42,+8,
+46,-21,-97,+40,-59,
+42,-9,+28,-41,-43,
-37,-19,+26,-61,+88
};

int r = R4;
int c = C5;

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=[
+84,-39,+82,+42,+8;
+46,-21,-97,+40,-59;
+42,-9,+28,-41,-43;
-37,-19,+26,-61,+88]

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


 Press return to continue. 


 ------------------------------------
 svdU :
 +0.014255  +0.928135  -0.346627  +0.134951 
 +0.748063  -0.162316  -0.161336  +0.622918 
 +0.074474  +0.309078  +0.919954  +0.229369 
 -0.659282  -0.129191  -0.086636  +0.735630 

 SvdValue :
+164.727104 
+138.381552 
+68.850021 
+56.402144 

 svdV :
 -0.383238  +0.637788  -0.077058  -0.397242  +0.531616 
 +0.026767  -0.239307  -0.149209  +0.609652  +0.740322 
 +0.524803  +0.702022  -0.155879  +0.422116  -0.171075 
 -0.410885  +0.200153  +0.776254  +0.420071  -0.109921 
 +0.638880  -0.055336  +0.587308  -0.340414  +0.357712 

 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.