Mathc matrices/c20o
Installer et compiler ces fichiers dans votre répertoire de travail.
c07b.c |
---|
/* ------------------------------------ */
/* Save as : c00h.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_diag.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rpdiag_mR(i_mR(r,r),9.);
double **U = r_mR(i_mR(r,r),9.);
double **Orth = i_mR(r,r);
double **D = i_mR(r,r);
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" u :");
p_mR(U,S3,P0,C6);
stop();
clrscrn();
orth_Diag_mR(A,U,Orth);
printf(" Orth :");
p_mR(Orth,S6,P3,C6);
Normalize_Diag_mR(A,Orth);
printf(" N_Orth : Normalise");
p_mR(Orth,S6,P3,C6);
mul_Diag_mR(A,Orth,Orth,D);
printf(" D : <N_Orth,N_Orth> ");
p_mR(D,S6,P3,C6);
f_mR(A);
f_mR(U);
f_mR(Orth);
f_mR(D);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
On orthogonalise la matrice u
Exemple de sortie écran :
------------------------------------
A :
+3 +0 +0 +0 +0
+0 +5 +0 +0 +0
+0 +0 +6 +0 +0
+0 +0 +0 +3 +0
+0 +0 +0 +0 +6
u :
+4 +4 -8 +2 -2
-1 -6 +3 +1 -7
-3 -8 +7 -5 +3
+6 +7 -3 -6 +6
-4 -1 -7 +2 +2
Press return to continue.
------------------------------------
Orth :
+4.000 -0.785 -7.388 +0.544 +1.328
-1.000 -4.804 -3.338 +2.035 -1.063
-3.000 -4.412 +0.357 -3.238 +0.582
+6.000 -0.177 -0.846 -5.288 -1.044
-4.000 +3.785 -3.901 -1.689 -0.334
N_Orth : Normalise
+0.227 -0.044 -0.417 +0.040 +0.323
-0.057 -0.269 -0.188 +0.149 -0.259
-0.170 -0.247 +0.020 -0.238 +0.141
+0.340 -0.010 -0.048 -0.388 -0.254
-0.227 +0.212 -0.220 -0.124 -0.081
D : <N_Orth,N_Orth>
+1.000 -0.000 -0.000 +0.000 +0.000
-0.000 +1.000 -0.000 -0.000 -0.000
-0.000 -0.000 +1.000 +0.000 +0.000
+0.000 -0.000 +0.000 +1.000 +0.000
+0.000 -0.000 +0.000 +0.000 +1.000
Press return to continue
Press X to stop