Mathc matrices/025
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **B = rupper_mR( i_mR(r,r),9.);
double **B_T = transpose_mR(B, i_mR(r,r));
double **S = i_mR(r,r);
double **U = i_mR(r,r);
double **U_T = i_mR(r,r);
double **V = i_mR(r,r);
double **V_T = i_mR(r,r);
double **T = i_mR(r,r);
clrscrn();
printf(" B :");
p_mR(B,S10,P5,C10);
printf(" U :");
svd_U_Rn_mR(B_T,U);
p_mR(U,S10,P5,C10);
printf(" V:");
svd_V_Rn_mR(B_T,V);
p_mR(V, S10,P5,C10);
printf(" S : U_T * B * V");
transpose_mR(U,U_T);
mul_mR(U_T,B,T);
mul_mR(T,V,S);
p_mR(S, S10,P5,C10);
stop();
clrscrn();
printf(" B :");
p_mR(B, S10,P3,C10);
printf(" B = U * S * V_T ");
transpose_mR(V,V_T);
mul_mR(U,S,T);
mul_mR(T,V_T,B);
p_mR(B, S10,P3,C10);
f_mR(B);
f_mR(B_T);
f_mR(V);
f_mR(V_T);
f_mR(U);
f_mR(U_T);
f_mR(S);
f_mR(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R2)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
B :
-1.00000 +4.00000 -9.00000
+0.00000 -3.00000 +4.00000
+0.00000 +0.00000 +3.00000
U :
+0.87102 -0.10920 +0.47896
-0.42931 -0.64312 +0.63410
-0.23879 +0.75794 +0.60705
V:
+0.07667 +0.06636 +0.99485
-0.42005 +0.90706 -0.02813
+0.90425 +0.41573 -0.09742
S : U_T * B * V
-11.36048 +0.00000 +0.00000
-0.00000 +1.64551 -0.00000
+0.00000 -0.00000 -0.48144
Press return to continue.
B :
-1.000 +4.000 -9.000
+0.000 -3.000 +4.000
+0.000 +0.000 +3.000
B = U * S * V_T
-1.000 +4.000 -9.000
+0.000 -3.000 +4.000
-0.000 +0.000 +3.000
Press return to continue
Press X return to stop