Mathc complexes/a9b
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00g.c |
|---|
/* ------------------------------------ */
/* Save as: c00g.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-1
#define ARRAY A3
/* ------------------------------------ */
#define RC RC3
/* ------------------------------------ */
void fun(void)
{
double **A = rcsymmetric_mZ( i_mZ(RC,RC),99);
double **AEVect = eigs_V_mZ(A, i_mZ(RC,RC),FACTOR_E);
double **InvAEVect = ctranspose_mZ(AEVect, i_mZ(RC,RC));
double **AEValue = eigs_mZ(A, i_mZ(RC,C1));
double **T = i_mZ(RC,RC);
double **a = i_mZ(RC,RC);
double **b [ARRAY];
double **r [ARRAY];
double **br [ARRAY];
double **EVabr[ARRAY];
int i;
for(i=A0; i<ARRAY; i++)
{
b[i] = c_c_mZ( AEVect,i+C1, i_mZ(RC,C1),C1);
r[i] = c_r_mZ(InvAEVect,i+R1, i_mZ(R1,RC),R1);
br[i] = mul_mZ(b[i],r[i], i_mZ(RC,RC));
EVabr[i] = smul_mZ(1./AEValue[i+R1][C1], br[i], i_mZ(RC,RC));
}
clrscrn();
printf(" A:");
p_mZ(A, S7,P0,S6,P0,C7);
printf(" eigenvectors of A");
p_mZ(AEVect, S5,P4,S5,P4,C7);
printf(" eigenvalues of A");
p_mZ(AEValue, S8,P0,S4,P0,C7);
stop();
clrscrn();
printf(" inv(A):");
inv_mZ(A, T);
pE_mZ(T, S12,P4,S12,P4,C7);
add_mZ(EVabr[0], EVabr[1], T);
add_mZ( T, EVabr[2], a);
printf(" We can calculate the inverse of A\n"
" by simply taking the inverse of \n"
" each of the eigenvalues. \n\n\n\n"
" 1/E1 b1r1 + 1/E2 b2r2 + 1/E3 b3r3 = inv(A)");
pE_mZ(a, S12,P4,S12,P4,C7);
f_mZ(A);
f_mZ(AEVect);
f_mZ(InvAEVect);
f_mZ(AEValue);
f_mZ(T);
f_mZ(a);
for(i=A0; i<ARRAY; i++)
{
f_mZ( b[i]);
f_mZ( r[i]);
f_mZ( br[i]);
f_mZ(EVabr[i]);
}
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous voyons une des propriétés de la décomposition spectral: * 1/E1 * b1r1 + 1/E2 * b2r2 + 1/E3 * b3r3 = inv(A) On peux calculer l'inverse de A en simplement prenant l'inverse de chacune des valeurs propres. Exemple de sortie écran :
A:
+20946 +0i +12885-10083i +6837 -4276i
+12885+10083i +23287 +0i +13142 -3812i
+6837 +4276i +13142 +3812i +15525 +0i
eigenvectors of A
+0.4154-0.4039i -0.2259+0.6276i -0.0518-0.4656i
+0.6690-0.1191i +0.0027-0.2538i -0.5471+0.4178i
+0.4501-0.0000i +0.7005+0.0000i +0.5538-0.0000i
eigenvalues of A
+46215 +0i
+10920 -0i
+2623 +0i
Press return to continue.
inv(A):
+1.3168e-04 -2.3873e-20i -7.0934e-05 +9.5502e-05i -2.1392e-05 -6.1993e-05i
-7.0934e-05 -9.5502e-05i +1.9655e-04 -3.5635e-20i -1.0884e-04 +7.0783e-05i
-2.1392e-05 +6.1993e-05i -1.0884e-04 -7.0783e-05i +1.6627e-04 -1.4144e-20i
We can calculate the inverse of A
by simply taking the inverse of
each of the eigenvalues.
1/E1 b1r1 + 1/E2 b2r2 + 1/E3 b3r3 = inv(A)
+1.3168e-04 +0.0000e+00i -7.0934e-05 +9.5502e-05i -2.1392e-05 -6.1993e-05i
-7.0934e-05 -9.5502e-05i +1.9655e-04 +0.0000e+00i -1.0884e-04 +7.0783e-05i
-2.1392e-05 +6.1993e-05i -1.0884e-04 -7.0783e-05i +1.6627e-04 +0.0000e+00i
Press return to continue
Press X return to stop x