Mathc matrices/c29a4
Installer et compiler ces fichiers dans votre répertoire de travail.
c04.c |
---|
/* ------------------------------------ */
/* Save as : c04.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rsymmetric_mR(i_mR(r,r),999.);
double **EigsVector= i_mR(r,r);
double **EigsVector_T= i_mR(r,r);
double **b1= i_mR(r,C1);
double **b2= i_mR(r,C1);
double **b3= i_mR(r,C1);
double **r1= i_mR(R1,r);
double **r2= i_mR(R1,r);
double **r3= i_mR(R1,r);
double **b1r1= i_mR(r,r);
double **b2r2= i_mR(r,r);
double **b3r3= i_mR(r,r);
double **T = i_mR(r,r);
clrscrn();
printf(" A:");
p_mR(A, S5, P0, C6);
eigs_V_mR(A, EigsVector);
printf(" EigsVector:");
p_mR(EigsVector, S5, P6, C6);
transpose_mR(EigsVector,EigsVector_T);
printf(" Inverse of EigsVector = EigsVector_T");
pE_mR(EigsVector_T, S12, P4, C6);
stop();
clrscrn();
c_c_mR(EigsVector, C1, b1, C1 );
c_c_mR(EigsVector, C2, b2, C1 );
c_c_mR(EigsVector, C3, b3, C1 );
c_r_mR(EigsVector_T, R1, r1, C1 );
c_r_mR(EigsVector_T, R2, r2, C1 );
c_r_mR(EigsVector_T, R3, r3, C1 );
mul_mR(b1, r1, b1r1);
mul_mR(b2, r2, b2r2);
mul_mR(b3, r3, b3r3);
mul_mR(b1r1, b2r2, T);
printf(" b1r1 * b2r2");
p_mR(T, S12, P3, C6);
mul_mR(b1r1, b3r3, T);
printf(" b1r1 * b3r3");
p_mR(T, S12, P3, C6);
mul_mR(b2r2, b3r3, T);
printf(" b2r2 * b3r3");
p_mR(T, S12, P3, C6);
f_mR(A);
f_mR(EigsVector);
f_mR(EigsVector_T);
f_mR(b1);
f_mR(b2);
f_mR(b3);
f_mR(r1);
f_mR(r2);
f_mR(r3);
f_mR(b1r1);
f_mR(b2r2);
f_mR(b3r3);
f_mR(T);
}
/* ------------------------------------ */
int main(void)
{
do
{
fun(R3);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous voyons une des propriétés de la décomposition spectral:
- b1r1 * b2r2 = 0
- b1r1 * b3r3 = 0
- b2r2 * b3r3 = 0
Cela matérialise simplement que nos projecteurs sont orthogonaux entre eux.
Exemple de sortie écran :
------------------------------------
A:
-479 -269 +992
-269 -501 +904
+992 +904 -763
EigsVector:
-0.512981 +0.544352 -0.663726
-0.485715 +0.453457 +0.747300
+0.707765 +0.705732 +0.031785
Inverse of EigsVector = EigsVector_T
-5.1298e-01 -4.8571e-01 +7.0777e-01
+5.4435e-01 +4.5346e-01 +7.0573e-01
-6.6373e-01 +7.4730e-01 +3.1785e-02
Press return to continue.
b1r1 * b2r2
+0.000 +0.000 +0.000
+0.000 +0.000 +0.000
-0.000 -0.000 -0.000
b1r1 * b3r3
+0.000 +0.000 -0.000
+0.000 -0.000 -0.000
+0.000 +0.000 +0.000
b2r2 * b3r3
+0.000 -0.000 -0.000
+0.000 -0.000 -0.000
+0.000 -0.000 -0.000
Press return to continue
Press X to stop