f_mR(Vect_U); 
 f_mR(Vect_T); 
 f_mR(Vect_Orth); 
 f_mR(Vect_projuv); 
 return(Orth);
/* ------------------------------------ */
/* ------- <u.v> = v^t SqrtA_T SqrtA u */
double **Normalize_Diag_mR(
double **A,
double **Orth
double **u = i_mR(rsize_R(Orth),C1);
double **Nu = i_mR(rsize_R(Orth),C1); 
int c_Orth = csize_R(Orth);
int c;
 for( c = C1; c <= c_Orth; c++)
 c_c_mR(Orth,c, u,C1); 
 smul_mR(1./norm_Diag_R(A,u),u,Nu);
 c_c_mR(Nu,C1, Orth,c); 
 f_mR(u); 
 f_mR(Nu); 
 return(Orth);
/* ------------------------------------ */
/* ------- <u.v> = v^t SqrtA_T SqrtA u */
double **mul_Diag_mR(
double **A,
double **U,
double **V,
double **UV
double **u = i_mR(rsize_R(U),C1);
double **v = i_mR(rsize_R(U),C1);
int c1;
int c2;
 for ( c1=C1; c1<U[C_SIZE][C0]; c1++)
 for ( c2=C1; c2<U[C_SIZE][C0]; c2++) 
 c_c_mR(U,c1, u,C1);
 c_c_mR(V,c2, v,C1);
 UV[c1][c2] = dot_Diag_R(A,u,v);
 f_mR(u);
 f_mR(v); 
 return(UV);
/* ------------------------------------ */
/* ------- <u.v> = v^t SqrtA_T SqrtA u */
void QR_Diag_mR(
double **A,
double **U,
double **Q,
double **R)
 orth_Diag_mR(A,U,Q);
 Normalize_Diag_mR(A,Q); 
 mul_Diag_mR(A,Q,U,R); 
/* ------------------------------------ */
/* ------------------------------------ */
double **eigs_value_Diag_mR(
double **A,
double **U,
double **EigsValue
int r = rsize_R(A);
double **T = i_mR(r,r);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
int i;
int rc;
 c_mR(U,T);
 for(i=0;i<LOOP_EIGSUV;i++)
 QR_Diag_mR(A,T,Q,R); 
 mul_mR(R,Q,T);

f_mR(T);
 f_mR(Q);
 f_mR(R); 
 return(EigsValue); 
/* ------------------------------------ */
double **xeigs_value_Diag_mR(
double **A,
double **U,
double **EigsValue
int r = rsize_R(A);
double **T = i_mR(r,r);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
int i;
int rc;
 c_mR(U,T);
do
 QR_Diag_mR(A,T,Q,R); 
 mul_mR(R,Q,T);
 clrscrn();
 pE_mR(T,S5,P3,C6); 
} while(stop_w());
 getchar();
 for(rc=R1;rc<=r;rc++)
 EigsValue[rc][C1] = T[rc][rc];

Mathc matrices/c20a
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00l.c */
void fun(int r)
double **A = rpdiag_mR(i_mR(r,r),9.);
double **U = r_mR(i_mR(r,r),9.);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
double **QR = i_mR(r,r);
 clrscrn(); 
 printf(" A :");
 p_mR(A,S3,P3,C6);
 printf(" U :");
 p_mR(U,S3,P3,C6);
 stop();
 clrscrn();
 printf(" U :");
 p_mR(U,S3,P3,C6); 
 QR_Diag_mR(A,U,Q,R); 
 printf(" Q : with QR_Diag_mR(A,U,Q,R);");
 p_mR(Q,S3,P5,C6);
 printf(" R :");
 p_mR(R,S10,P5,C6);
 printf(" U = Q * R :"); 
 mul_mR(Q,R, QR);
 p_mR(QR,S3,P3,C6);
 stop();
 clrscrn(); 
 printf(" U :");
 p_mR(U,S3,P3,C6);
 QR_uv_mR(U,Q,R); 
 printf(" Q : with QR_uv_mR(U,Q,R);");
 p_mR(Q,S3,P5,C6);
 printf(" R :");
 p_mR(R,S10,P5,C6);
 printf(" U = Q * R :"); 
 mul_mR(Q,R, QR);
 p_mR(QR,S3,P3,C6); 
 f_mR(A);
 f_mR(U);
 f_mR(Q);
 f_mR(R);
 f_mR(QR);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R2);
} while(stop_w());
 return 0;
/* ------------------------------------ */

Exemple de sortie écran :
 A :
+1.000 +0.000 +0.000 +0.000 
+0.000 +1.000 +0.000 +0.000 
+0.000 +0.000 +9.000 +0.000 
+0.000 +0.000 +0.000 +6.000 
 U :
-7.000 +6.000 -6.000 +4.000 
+8.000 +8.000 -6.000 +2.000 
+2.000 -4.000 +6.000 -4.000 
+1.000 -6.000 +3.000 +5.000 
 Press return to continue. 
 ------------------------------------ 
 U :
-7.000 +6.000 -6.000 +4.000 
+8.000 +8.000 -6.000 +2.000 
+2.000 -4.000 +6.000 -4.000 
+1.000 -6.000 +3.000 +5.000 
 Q : with QR_Diag_mR(A,U,Q,R);
-0.56225 +0.10422 +0.13588 +0.80904 
+0.64258 +0.61260 -0.21950 +0.40452 
+0.16064 -0.14235 +0.23867 +0.08989 
+0.08032 -0.26817 -0.26480 +0.13484 
 R :
 +12.44990 -6.90769 +9.63863 -4.33738 
 -0.00000 +20.30477 -16.81473 -1.27858 
 -0.00000 +0.00000 +8.62331 -16.43133 
 -0.00000 +0.00000 -0.00000 +4.85424 
 U = Q * R :
-7.000 +6.000 -6.000 +4.000 
+8.000 +8.000 -6.000 +2.000 
+2.000 -4.000 +6.000 -4.000 
+1.000 -6.000 +3.000 +5.000 
 Press return to continue. 
 ------------------------------------ 
 U :
-7.000 +6.000 -6.000 +4.000 
+8.000 +8.000 -6.000 +2.000 
+2.000 -4.000 +6.000 -4.000 
+1.000 -6.000 +3.000 +5.000 
 Q : with QR_uv_mR(U,Q,R);
-0.64440 +0.52610 -0.01660 +0.55470 
+0.73646 +0.60598 -0.11618 +0.27735 
+0.18411 -0.33604 +0.73857 +0.55470 
+0.09206 -0.49304 -0.66388 +0.55470 
 R :
 +10.86278 +0.73646 +0.82852 -1.38086 
 +0.00000 +12.30681 -10.28781 +2.19528 
 +0.00000 -0.00000 +3.23643 -6.57244 
 +0.00000 -0.00000 +0.00000 +3.32820 
 U = Q * R :
-7.000 +6.000 -6.000 +4.000 
+8.000 +8.000 -6.000 +2.000 
+2.000 -4.000 +6.000 -4.000 
+1.000 -6.000 +3.000 +5.000 
 Press return to continue
 Press X to stop

Mathc matrices/c20b
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00a.c */
void fun(int r)
double **A = rpdiag_mR(i_mR(r,r),9);
double **u = r_mR(i_mR(r,C1),99.);
double **v = r_mR(i_mR(r,C1),99.);
 clrscrn();
 printf(" A :");
 p_mR(A,S3,P0,C6);
 printf(" u :");
 p_mR(u,S3,P0,C6);
 printf(" v :");
 p_mR(v,S3,P0,C6);
 printf(" <u,v> = v^t sqrt(A)^t sqrt(A) u \n");
 printf(" <u,v> = %.0f \n", dot_Diag_R(A,u,v));
 printf(" <v,u> = %.0f \n", dot_Diag_R(A,v,u));
 f_mR(A);
 f_mR(u);
 f_mR(v);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R1);
} while(stop_w());
 return 0;
/* ------------------------------------ */
Dans cet exemple nous utilisons une matrice diagonale aléatoire.

Exemple de sortie écran :
 A :
 +6 +0 
 +0 +2 
 u :
-43 
+66 
 v :
-10 
+19 
 <u,v> = v^t sqrt(A)^t sqrt(A) u 
 <u,v> = 5088 
 <v,u> = 5088 
 Press return to continue
 Press X to stop

Mathc matrices/c20c
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
void fun(int r,int c)
double **A = r_mR(i_mR(r,c),99.);
 clrscrn();
 printf(" A :\n");
 pall_mR(A,S5,P0,C10); 
 printf(" A :\n");
 pall_mR(swapcoefR0_mR(A,C1,C2),S5,P0,C10); 
 f_mR(A);
/* ------------------------------------ */
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;
/* ------------------------------------ */

Exemple de sortie écran :
 A :
+3 +1 +2 +3 
+4 +30 +32 +73 
+0 +54 +81 +15 
 A :
+3 +2 +1 +3 
+4 +30 +32 +73 
+0 +54 +81 +15 
 Press return to continue
 Press X to stop

Mathc matrices/c20d
Application 
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00b.c */
void fun(int r)
double **A = rpdiag_mR( i_mR(r,r ), 9.);
double **u = r_mR( i_mR(r,C1), 9.);
 clrscrn();
 printf(" A :");
 p_mR(A,S3,P0,C6);
 printf(" u :");
 p_mR(u,S3,P0,C6);
 printf(" <u,u> = ||u||^2 (u^t*A^t*A*u)\n\n");
 printf(" (<u,u>)^(1/2) = %.3f \n",
 pow(dot_Diag_R(A,u,u),(1./2.)));
 printf(" ||u|| = %.3f \n\n",
 norm_Diag_R(A,u));
 f_mR(A);
 f_mR(u);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R2);
} while(stop_w());
 return 0;
/* ------------------------------------ */
Nous calculons la norm d'un vecteur.

Exemple de sortie écran :
 A :
 +8 +0 +0 +0 +0 
 +0 +4 +0 +0 +0 
 +0 +0 +1 +0 +0 
 +0 +0 +0 +9 +0 
 +0 +0 +0 +0 +8 
 u :
 +2 
 -2 
 -6 
 +3 
 +9 
 <u,u> = ||u||^2 (u^t*A^t*A*u)
 (<u,u>)^(1/2) = 28.513 
 ||u|| = 28.513 
 Press return to continue
 Press X to stop

Mathc matrices/c20e
Application
Copier la bibliothèque dans votre répertoire de travail avec les fichiers des parties précédentes :
Dans ce produit scalaire la matrice A est une matrice diagonale avec des coefficient positif. 
Ils correspondent aux poids que l'on impose à chaque terme du produit scalaire. C'est le produit scalaire standard avec poids.
Exemple à modifier :