Mathc matrices/c12b3
Application 
Installer ce fichier dans votre répertoire de travail.
/* Save as : ccn1e.c */
/* ------------------------------------ */
void fun(int r,int c)
double **A = r_mR(i_mR(r,c),9.);
double **a = i_mR(r,c);
double **U = i_mR(r,r);
double **V = i_mR(c,c);
double **U_T = i_mR(r,r);
double **V_T = i_mR(c,c);
double **U_TA = i_mR(r,c); /* rr rc */
double **S = i_mR(r,c);
double **US = i_mR(r,c); /* rr rc */
 clrscrn();
 printf(" Copy/Past into the octave windows \n\n\n");
 p_Octave_mR(A,"A",P2);
 printf(" [U, S, V] =svd (A,10)\n\n\n");
 stop();
 clrscrn(); 
 svd_U_Cn_uv_mR(A,U); 
 svd_V_Cn_uv_mR(A,V); 
 printf(" U :");
 p_mR(U ,S10,P6,C10); 
 printf(" V ");
 p_mR(V,S10,P6,C10); 
 transpose_mR( U,U_T);
/* S = U_T * A * V */
 mul_mR(U_T,A,U_TA);
 mul_mR(U_TA,V,S);
 printf(" S = U_T * A * V :");
 p_mR(S,S10,P5,C10); 
 stop();
 clrscrn();
 transpose_mR(V,V_T);
/* A = U * S * V_T */
 mul_mR(U,S,US);
 mul_mR(US,V_T,a);
 printf(" A :");
 p_mR(A ,S10,P6,C10); 
 printf(" A = U * S * V_T ");
 p_mR(a,S10,P6,C10); 
 f_mR(A);
 f_mR(a); 
 f_mR(U);
 f_mR(V); 
 f_mR(U_T);
 f_mR(V_T); 
 f_mR(U_TA);
 f_mR(S); 
 f_mR(US); 
int main(void)
time_t t;
 srand(time(&t));
int i;
do
 i = rp_I(R3)+R1;
 fun(i,i+C1);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Dans cet exemple on vérifie que A = U * S * V_T.
 Exemple de sortie écran :
 Copy/Past into the octave windows 
 A=[
+4.00,-9.00,+4.00,-3.00,+4.00,-7.00;
-3.00,+6.00,+6.00,+2.00,+4.00,+8.00;
+6.00,-9.00,+8.00,-1.00,-3.00,-7.00;
-3.00,+2.00,+4.00,+2.00,-7.00,-5.00]
 [U, S, V] =svd (A,10)
 Press return to continue. 
 ------------------------------------ 
 U :
 +0.587930 -0.411385 +0.159656 +0.677946 
 -0.410144 -0.103193 +0.902580 +0.080510 
 +0.690032 +0.160158 +0.384660 -0.591813 
 +0.099883 +0.891326 +0.109066 +0.428562 
 V 
 -0.348395 +0.273605 -0.008539 +0.636541 +0.629582 -0.000000 
 +0.645975 -0.307306 +0.071007 -0.151982 +0.657789 -0.213340 
 -0.272731 -0.231687 +0.924606 -0.046963 +0.018612 -0.121413 
 +0.144299 -0.237825 +0.112069 +0.114025 +0.000000 +0.944595 
 +0.096601 +0.787710 +0.225314 -0.486712 +0.190516 +0.200505 
 +0.597328 +0.316192 +0.276880 +0.565350 -0.366466 -0.085336 
 S = U_T * A * V :
 -21.30538 +0.00000 +0.00000 +0.00000 -0.00000 -0.00000 
 +0.00000 -11.14379 +0.00000 -0.00000 +0.00000 +0.00000 
 +0.00000 +0.00000 +10.34781 +0.00000 +0.00000 -0.00000 
 -0.00000 +0.00000 +0.00000 -3.71745 +0.00000 -0.00000 
 Press return to continue. 
 ------------------------------------ 
 A :
 +4.000000 -9.000000 +4.000000 -3.000000 +4.000000 -7.000000 
 -3.000000 +6.000000 +6.000000 +2.000000 +4.000000 +8.000000 
 +6.000000 -9.000000 +8.000000 -1.000000 -3.000000 -7.000000 
 -3.000000 +2.000000 +4.000000 +2.000000 -7.000000 -5.000000 
 a = U * S * V_T 
 +4.000000 -9.000000 +4.000000 -3.000000 +4.000000 -7.000000 
 -3.000000 +6.000000 +6.000000 +2.000000 +4.000000 +8.000000 
 +6.000000 -9.000000 +8.000000 -1.000000 -3.000000 -7.000000 
 -3.000000 +2.000000 +4.000000 +2.000000 -7.000000 -5.000000 
 Press return to continue
 Press X to stop

Mathc matrices/c12b7
Application
Installer ce fichier dans votre répertoire de travail.
/* Save as : ccn3e.c */
/* ------------------------------------ */
void fun(int r,int c)
double **A = r_mR(i_mR(r,c),9.);
double **a = i_mR(r,c);
double **U = i_mR(r,r);
double **V = i_mR(c,c);
double **U_T = i_mR(r,r);
double **V_T = i_mR(c,c);
double **U_TA = i_mR(r,c); /* rr rc */
double **S = i_mR(r,c);
double **US = i_mR(r,c); /* rr rc */
 clrscrn();
 printf(" Copy/Past into the octave windows \n\n\n");
 p_Octave_mR(A,"A",P2);
 printf(" [U, S, V] =svd (A,10)\n\n\n");
 stop();
 clrscrn(); 
 svd_U_Cn_uv_mR(A,U); 
 svd_V_Cn_uv_mR(A,V); 
 printf(" U :");
 p_mR(U ,S10,P6,C10); 
 printf(" V ");
 p_mR(V,S10,P6,C10); 
 transpose_mR( U,U_T);
/* S = U_T * A * V */
 mul_mR(U_T,A,U_TA);
 mul_mR(U_TA,V,S);
 printf(" S = U_T * A * V :");
 p_mR(S,S10,P5,C10); 
 stop();
 clrscrn();
 transpose_mR(V,V_T);
/* A = U * S * V_T */
 mul_mR(U,S,US);
 mul_mR(US,V_T,a);
 printf(" A :");
 p_mR(A ,S10,P6,C10); 
 printf(" A = U * S * V_T ");
 p_mR(a,S10,P6,C10); 
 f_mR(A);
 f_mR(a); 
 f_mR(U);
 f_mR(V); 
 f_mR(U_T);
 f_mR(V_T); 
 f_mR(U_TA);
 f_mR(S); 
 f_mR(US); 
int main(void)
time_t t;
 srand(time(&t));
int i;
do
 i = rp_I(R3)+R1;
 fun(i,i+C3);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Dans cet exemple on vérifie que A = U * S * V_T.
 Exemple de sortie écran :
 Copy/Past into the octave windows 
 A=[
+6.00,-5.00,-9.00,-1.00,-9.00,-7.00,+8.00;
+8.00,+2.00,-3.00,+6.00,-5.00,-1.00,+6.00;
+8.00,-9.00,-7.00,-1.00,-7.00,-1.00,-7.00;
+2.00,-9.00,+6.00,+6.00,-5.00,+2.00,+8.00]
 [U, S, V] =svd (A,10)
 Press return to continue. 
 ------------------------------------ 
 U :
 +0.697032 -0.052053 -0.435660 -0.567130 
 +0.398267 +0.271334 -0.406011 +0.776477 
 +0.499582 -0.621376 +0.550049 +0.248506 
 +0.325495 +0.733185 +0.585493 -0.117010 
 V 
 -0.493283 -0.103373 +0.024085 +0.573255 +0.354196 -0.255488 -0.561344 
 +0.415216 -0.012768 +0.733636 +0.402661 -0.327467 -0.057098 -0.109646 
 +0.369971 +0.527650 -0.397873 +0.041853 -0.212080 -0.543889 -0.483772 
 -0.129149 +0.420736 -0.079756 +0.537120 +0.000000 +0.000000 +0.653231 
 +0.549656 -0.012839 +0.068513 +0.008454 +0.822028 +0.000000 +0.000000 
 +0.210437 +0.136934 -0.337796 +0.340570 +0.000000 +0.767554 -0.000000 
 -0.290352 +0.717497 +0.421585 -0.320832 +0.215877 +0.215664 -0.110110 
 S = U_T * A * V :
 -24.35920 +0.00000 -0.00000 +0.00000 -0.00000 +0.00000 -0.00000 
 -0.00000 +15.92576 +0.00000 +0.00000 +0.00000 +0.00000 -0.00000 
 -0.00000 +0.00000 -12.06812 +0.00000 +0.00000 +0.00000 -0.00000 
 -0.00000 +0.00000 +0.00000 +7.95991 +0.00000 +0.00000 +0.00000 
 Press return to continue. 
 ------------------------------------ 
 A :
 +6.000000 -5.000000 -9.000000 -1.000000 -9.000000 -7.000000 +8.000000 
 +8.000000 +2.000000 -3.000000 +6.000000 -5.000000 -1.000000 +6.000000 
 +8.000000 -9.000000 -7.000000 -1.000000 -7.000000 -1.000000 -7.000000 
 +2.000000 -9.000000 +6.000000 +6.000000 -5.000000 +2.000000 +8.000000 
 a = U * S * V_T 
 +6.000000 -5.000000 -9.000000 -1.000000 -9.000000 -7.000000 +8.000000 
 +8.000000 +2.000000 -3.000000 +6.000000 -5.000000 -1.000000 +6.000000 
 +8.000000 -9.000000 -7.000000 -1.000000 -7.000000 -1.000000 -7.000000 
 +2.000000 -9.000000 +6.000000 +6.000000 -5.000000 +2.000000 +8.000000 
 Press return to continue
 Press X to stop