Mathc matrices/c12b12
Propriétés
Mathc matrices/c12b13
Fonctions de bases
Mathc matrices/c12b14
Application
Installer ce fichier dans votre répertoire de travail.
/* Save as : ccn4e.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);
 stop();
 clrscrn(); 
 printf(" V ");
 p_mR(V,S10,P6,C6); 
 stop();
 clrscrn(); 
 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,C6); 
 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,C6); 
 printf(" a = U * S * V_T ");
 p_mR(a,S10,P6,C6); 
 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+C4);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Vérifiez le résultat avec octave.
 Dans cet exemple on vérifie que A = U * S * V_T.
 Exemple de sortie écran :
 Copy/Past into the octave windows 
 A=[
+8.00,-9.00,-7.00,+6.00,-7.00,-7.00,+8.00,+2.00;
-5.00,-7.00,+4.00,+8.00,-9.00,+4.00,-5.00,-5.00;
-5.00,+6.00,-7.00,-5.00,+4.00,-7.00,-1.00,-7.00;
-1.00,-3.00,-3.00,+8.00,-9.00,-3.00,-7.00,-5.00]
 [U, S, V] =svd (A,10)
 Press return to continue. 
 ------------------------------------ 
 U :
 +0.529990 +0.810010 +0.127002 -0.216485 
 +0.576012 -0.533518 -0.052847 -0.617070 
 -0.321263 -0.022415 +0.877384 -0.355647 
 +0.533021 -0.242363 +0.459646 +0.667738 
 Press return to continue. 
 ------------------------------------ 
 V 
 -0.101109 +0.509407 +0.228805 -0.502911 -0.615152 -0.079441 
 +0.512313 -0.158839 -0.199675 -0.434900 +0.000000 +0.634664 
 +0.031420 -0.370988 +0.553102 +0.095229 -0.346294 +0.193358 
 -0.567576 -0.066204 +0.023771 -0.180566 +0.000000 +0.000000 
 +0.622336 +0.065576 +0.066767 +0.074132 -0.182130 -0.604496 
 +0.031420 -0.370988 +0.553102 +0.095229 +0.000000 +0.000000 
 +0.085188 +0.582559 +0.180581 +0.605183 -0.018275 +0.433692 
 +0.092931 +0.303235 +0.508234 -0.368048 +0.684225 +0.000000 
 -0.114849 +0.000000 
 -0.000000 +0.000000 
 -0.082383 -0.707107 
 +0.741276 -0.000000 
 +0.653524 -0.000000 
 +0.000000 +0.707107 
 +0.058641 +0.000000 
 -0.000000 -0.000000 
 Press return to continue. 
 ------------------------------------ 
 S = U_T * A * V :
 -24.06463 -0.00000 +0.00000 +0.00000 +0.00000 +0.00000 
 -0.00000 +18.65327 -0.00000 -0.00000 +0.00000 +0.00000 
 +0.00000 -0.00000 -15.58669 -0.00000 -0.00000 +0.00000 
 -0.00000 +0.00000 +0.00000 -4.89942 +0.00000 +0.00000 
 -0.00000 -0.00000 
 +0.00000 +0.00000 
 -0.00000 -0.00000 
 -0.00000 -0.00000 
 Press return to continue. 
 A :
 +8.000000 -9.000000 -7.000000 +6.000000 -7.000000 -7.000000 
 -5.000000 -7.000000 +4.000000 +8.000000 -9.000000 +4.000000 
 -5.000000 +6.000000 -7.000000 -5.000000 +4.000000 -7.000000 
 -1.000000 -3.000000 -3.000000 +8.000000 -9.000000 -3.000000 
 +8.000000 +2.000000 
 -5.000000 -5.000000 
 -1.000000 -7.000000 
 -7.000000 -5.000000 
 a = U * S * V_T 
 +8.000000 -9.000000 -7.000000 +6.000000 -7.000000 -7.000000 
 -5.000000 -7.000000 +4.000000 +8.000000 -9.000000 +4.000000 
 -5.000000 +6.000000 -7.000000 -5.000000 +4.000000 -7.000000 
 -1.000000 -3.000000 -3.000000 +8.000000 -9.000000 -3.000000 
 +8.000000 +2.000000 
 -5.000000 -5.000000 
 -1.000000 -7.000000 
 -7.000000 -5.000000 
 Press return to continue
 Press X to stop

Mathc matrices/c12b15
Application
Installer ce fichier dans votre répertoire de travail.
/* Save as : ccn4f.c */
/* ------------------------------------ */
void fun(int r,int c)
double **A = r_mR(i_mR(r,c),9.);
double **U = i_mR(r,r);
double **V = i_mR(c,c);
double **U_T = i_mR(r,r);
double **U_TA = i_mR(r,c);
double **S = i_mR(r,c);
double **S_T = i_mR(c,r);
double **invS_T = i_mR(c,r); 
double **VS_T = i_mR(c,r); /* cc cr VS_T */
double **Pinv = i_mR(c,r); /* cc cr rr VS_TU_T */
double **Ide = i_mR(r,r); /* rc cc cr rr AVS_TU_T */
 clrscrn();
 printf(" Copy/Past into the octave windows \n\n\n");
 p_Octave_mR(A,"A",P2);
 printf("pinv(A)\n\n\n");
 stop();
 clrscrn(); 
 svd_U_Cn_uv_mR(A,U); 
 svd_V_Cn_uv_mR(A,V); 
 /* S = U_T * B * V */ 
 transpose_mR( U,U_T);
 mul_mR(U_T,A,U_TA);
 mul_mR(U_TA,V,S);
 transpose_mR(S,S_T);
 svd_inv_D_uv_mR(S_T,invS_T); 
/* PseudoInverse = V * invS_T * U_T */ 
 mul_mR(V,invS_T,VS_T);
 mul_mR(VS_T,U_T,Pinv);
 printf(" PseudoInverse = V * invS_T * U_T "); 
 pE_mR(Pinv,S10,P6,C10); 
 printf(" Ide = A * PseudoInverse ");
 mul_mR(A,Pinv,Ide); 
 p_mR(Ide,S10,P6,C10); ; 
 f_mR(A); 
 f_mR(U);
 f_mR(V); 
 f_mR(U_T); 
 f_mR(U_TA);
 f_mR(S); 
 f_mR(S_T);
 f_mR(invS_T);
 f_mR(VS_T);
 f_mR(Pinv); 
 f_mR(Ide); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
int i;
do
 i = rp_I(R3)+R1;
 fun(i,i+C4);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Vérifiez le résultat avec octave.
 Dans cet exemple on vérifie que PseudoInverse = V * invS_T * U_T
 Exemple de sortie écran :
 Copy/Past into the octave windows 
 A=[
-5.00,+4.00,+4.00,+2.00,+8.00,-3.00,-3.00;
-7.00,-3.00,+2.00,-1.00,-9.00,-1.00,+2.00;
+8.00,+6.00,-7.00,-9.00,+4.00,-3.00,-9.00]
pinv(A)
 Press return to continue. 
 PseudoInverse = V * invS_T * U_T 
-5.560545e-02 -6.416794e-02 -2.440291e-05 
+2.907460e-02 +5.991402e-03 +1.965606e-02 
+3.084674e-02 +6.474092e-03 -1.887931e-02 
+1.434403e-03 -4.477592e-02 -4.413535e-02 
+3.747604e-02 -5.891936e-02 -1.156063e-02 
-3.158371e-02 -3.586788e-02 -2.224203e-02 
-2.828639e-02 -2.753380e-02 -3.693356e-02 
 Ide = A * PseudoInverse 
 +1.000000 -0.000000 +0.000000 
 -0.000000 +1.000000 -0.000000 
 -0.000000 +0.000000 +1.000000 
 Press return to continue
 Press X to stop

Mathc matrices/c12b16
Application
Installer ce fichier dans votre répertoire de travail.
/* Save as : c00b.c */
void fun(void)
double tA[RA*CA]={
 +8.00, -5.00, +1.00, +3.00, +8.00, 
 -2.00, +6.00, -2.00, -8.00, -2.00, 
 +3.00, -9.00, +9.00, +7.00, -7.00 
double **A = ca_A_mR(tA,i_mR(RA,CA));
double **Pinv = i_mR(CA,RA); 
double **Ide = i_mR(RA,RA); 
 clrscrn();
 printf(" A :");
 p_mR(A,S7,P2,C7); 
 printf(" PseudoInverse = V * invS_T * U_T ");
 pseudo_Cn_uv_mR(A,Pinv,FACTOR_E); 
 pE_mR(Pinv,S12,P4,C10);
 printf(" Ide = A * Pinv ");
 mul_mR(A,Pinv,Ide); 
 p_mR(Ide,S7,P2,C10); 
 stop();
 f_mR(A); 
 f_mR(Pinv); 
 f_mR(Ide); 
/* ------------------------------------ */
int main(void)
 fun();
 return 0;
/* ------------------------------------ */
Cet version fonctionne quand il y a plus de colonnes que de lignes. 
 pseudo_Cn_uv_mR(A,Pinv,FACTOR_E);
 Exemple de sortie écran :
 A :
 +8.00 -5.00 +1.00 +3.00 +8.00 
 -2.00 +6.00 -2.00 -8.00 -2.00 
 +3.00 -9.00 +9.00 +7.00 -7.00 
 PseudoInverse = V * invS_T * U_T 
 +8.9736e-02 +9.4303e-02 +3.8876e-02 
 -1.6303e-02 +1.4763e-02 -2.4265e-02 
 +2.5728e-02 +6.4743e-02 +5.8226e-02 
 -5.1374e-02 -1.4389e-01 -2.9953e-02 
 +4.1124e-02 -3.9211e-02 -5.0088e-02 
 Ide = A * Pinv 
 +1.00 -0.00 -0.00 
 -0.00 +1.00 +0.00 
 +0.00 +0.00 +1.00 
 Press return to continue.