< Mathc matrices
Installer ce fichier dans votre répertoire de travail.
![]() |
ca34.c ' |
---|
/* ------------------------------------ */
/* Save as : ca34.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double ab[R3*C4]={
-33,+14,-65,-13,
-15,-93,-87,-17,
-13,+58,+20,+50
};
int r = R3;
int c = C4;
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=[
-33,+14,-65,-13;
-15,-93,-87,-17;
-13,+58,+20,+50]
[U, S, V] =svd (a,10)
Press return to continue.
------------------------------------
svdU :
+0.279547 +0.832774 -0.477851
+0.857083 +0.007871 +0.515118
-0.432738 +0.553558 +0.711556
SvdValue :
+149.391918
+72.495701
+35.643064
svdV :
+0.110151 -0.479971 -0.033889 +0.869682
+0.675364 +0.593596 -0.373864 +0.227494
+0.678695 -0.603400 +0.013359 -0.418453
+0.266691 +0.230607 +0.926768 +0.129606
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.