Mathc matrices/c12an6
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RB R3
#define CB C4
/* ------------------------------------ */
void fun(void)
{
double **B = r_mR( i_mR(RB,CB),9.);
double **U = i_mR(RB,RB);
double **UT = i_mR(RB,RB);
double **UTU = i_mR(RB,RB);
double **V = i_mR(CB,CB);
double **VT = i_mR(CB,CB);
double **VVT = i_mR(CB,CB);
svd_U_Cn_mR(B,U);
svd_V_Cn_mR(B,V);
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"
" U*U'\n"
" V*V'\n\n");
printf(" U :");
p_mR(U, S5,P5,C10);
printf(" V:");
p_mR(V, S5,P5,C10);
stop();
clrscrn();
printf(" UT U :");
transpose_mR(U,UT);
mul_mR(UT,U,UTU);
p_mR(UTU ,S10,P3,C10);
printf(" U UT :");
mul_mR(U,UT,UTU);
p_mR(UTU ,S10,P3,C10);
printf(" V VT :");
transpose_mR(V,VT);
mul_mR(V,VT,VVT);
p_mR(VVT ,S10,P3,C10);
printf(" VT V :");
mul_mR(VT,V,VVT);
p_mR(VVT ,S10,P3,C10);
getchar();
f_mR(B);
f_mR(U);
f_mR(UT);
f_mR(UTU);
f_mR(V);
f_mR(VT);
f_mR(VVT);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
Copy/Past into the octave windows
B=[
+8.00,-1.00,+5.00,+8.00;
-2.00,+5.00,-9.00,+2.00;
+1.00,+1.00,-8.00,-7.00]
[U, S, V] =svd (B,10)
U*U'
V*V'
U :
-0.67160 -0.56757 +0.47626
+0.45704 -0.82328 -0.33663
+0.58316 -0.00841 +0.81232
V:
-0.35017 -0.32418 +0.86431 -0.15893
+0.21733 -0.39733 -0.21986 -0.86403
-0.74511 +0.51816 -0.17750 -0.38053
-0.52436 -0.68450 -0.41609 +0.28876
Press return to continue.
UT U :
+1.000 -0.000 +0.000
-0.000 +1.000 -0.000
+0.000 -0.000 +1.000
U UT :
+1.000 -0.000 +0.000
-0.000 +1.000 +0.000
+0.000 +0.000 +1.000
V VT :
+1.000 +0.000 -0.000 +0.000
+0.000 +1.000 +0.000 +0.000
-0.000 +0.000 +1.000 +0.000
+0.000 +0.000 +0.000 +1.000
VT V :
+1.000 +0.000 +0.000 +0.000
+0.000 +1.000 -0.000 +0.000
+0.000 -0.000 +1.000 +0.000
+0.000 +0.000 +0.000 +1.000
Press return to continue.