Mathc matrices/a69
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RB R4
#define CB C2
/* ------------------------------------ */
int main(void)
{
double b[RB*CB]={
-3.00,+3.00,
+6.00,+8.00,
+8.00,-9.00,
-1.00,-4.00
};
double **B = ca_A_mR(b, i_mR(RB,CB));
double **B_T = transpose_mR(B, i_mR(CB,RB));
double **S = i_mR(CB,C1);
double **U = i_mR(RB,CB);
double **V = i_mR(CB,CB);
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);
svds_mR(B,S);
printf(" U :");
p_mR(U,S5,P5,C10);
printf(" S :");
p_mR(S,S5,P5,C10);
printf(" V:");
p_mR(V,S5,P5,C10);
stop();
f_mR(B_T);
f_mR(B);
f_mR(S);
f_mR(U);
f_mR(V);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Cet version fonctionne quand il y a plus de lignes que 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=[
-3.00,+3.00;
+6.00,+8.00;
+8.00,-9.00;
-1.00,-4.00]
[U, S, V] =svd (B,10)
Press return to continue.
U :
-0.28974 -0.16712
-0.38334 +0.86361
+0.84140 +0.40785
+0.24728 -0.24477
S :
+13.48055
+9.91336
V:
-0.37484 +0.92709
+0.92709 +0.37484
Press return to continue.