Mathc complexes/a322
Apparence
Décomposition d'une matrice en éléments propres
Installer et compiler ces fichiers dans votre répertoire de travail.
c00c.c |
---|
/* ------------------------------------ */
/* save as : c00c.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-4
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = rcsymmetric_mZ( i_mZ(rc,rc),99);
double **A_T = ctranspose_mZ(A, i_mZ(rc,rc));
double **U = X_U_mZ(A_T, i_mZ(rc,rc),FACTOR_E);
double **U_T = ctranspose_mZ(U, i_mZ(rc,rc));
double **U_TA = mul_mZ(U_T, A, i_mZ(rc,rc));
double **X = mul_mZ(U_TA, U, i_mZ(rc,rc));
double **invX = X_inv_mZ(X, i_mZ(rc,rc));
double **UinvX = mul_mZ(U,invX, i_mZ(rc,rc));
double **Inv = mul_mZ(UinvX,U_T, i_mZ(rc,rc));
double **InvA = mul_mZ(Inv,A, i_mZ(rc,rc));
double **AInv = mul_mZ(A,Inv, i_mZ(rc,rc));
clrscrn();
printf(" A :");
p_mZ(A, S9,P1, S8,P1, C4);
printf(" U :");
p_mZ(U, S9,P4, S8,P4, C4);
printf(" X = U_T * A * U :");
p_mZ(X, S11,P3, S7,P3, C4);
stop();
clrscrn();
printf(" Inv = U * invX * U_T :");
pE_mZ(Inv, S9,P2, S8,P2, C4);
printf(" Ide = Inv * A :");
p_mZ(InvA, S6,P1, S4,P1, C4);
printf(" Ide = A * Inv :");
p_mZ(AInv, S6,P1, S4,P1, C4);
f_mZ(A);
f_mZ(A_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(X);
f_mZ(invX);
f_mZ(UinvX);
f_mZ(Inv);
f_mZ(InvA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+19707.0 +0.0i +10560.0 +8662.0i +987.0 -91.0i -14428.0+12921.0i
+10560.0 -8662.0i +28914.0 +0.0i +7456.0 +5926.0i +2551.0+17153.0i
+987.0 +91.0i +7456.0 -5926.0i +15943.0 +0.0i +3713.0-11437.0i
-14428.0-12921.0i +2551.0-17153.0i +3713.0+11437.0i +40343.0 +0.0i
U :
-0.2976 +0.3276i -0.1430 -0.2219i +0.7856 +0.0092i +0.1648 -0.2999i
+0.0803 +0.4963i -0.0534 -0.5775i -0.5099 +0.1321i +0.1626 -0.3271i
+0.1178 -0.0954i -0.1849 -0.6399i +0.1557 -0.1562i -0.0990 +0.6892i
+0.7269 +0.0000i +0.3877 -0.0000i +0.2380 +0.0000i +0.5145 +0.0000i
X = U_T * A * U :
+66172.758 +0.000i +0.000 +0.000i +0.000 -0.000i -0.000 -0.000i
+0.000 -0.000i +29470.448 -0.000i -0.000 -0.000i +0.000 -0.000i
+0.000 -0.000i -0.000 +0.000i +7203.959 -0.000i +0.000 +0.000i
+0.000 -0.000i +0.000 +0.000i +0.000 -0.000i +2059.835 -0.000i
Press return to continue.
Inv = U * invX * U_T :
+1.48e-04+4.45e-21i +1.19e-05-1.23e-05i -8.68e-05-2.50e-05i +6.20e-05-7.39e-05i
+1.19e-05+1.23e-05i +1.19e-04+6.67e-21i -1.19e-04-4.34e-05i +2.40e-05-7.95e-05i
-8.68e-05+2.50e-05i -1.19e-04+4.34e-05i +2.57e-04+2.03e-20i -2.07e-05+1.58e-04i
+6.20e-05+7.39e-05i +2.40e-05+7.95e-05i -2.07e-05-1.58e-04i +1.49e-04+7.60e-21i
Ide = Inv * A :
+1.0-0.0i -0.0+0.0i +0.0-0.0i -0.0+0.0i
-0.0-0.0i +1.0+0.0i -0.0+0.0i -0.0-0.0i
+0.0+0.0i -0.0-0.0i +1.0-0.0i +0.0+0.0i
+0.0-0.0i -0.0+0.0i +0.0+0.0i +1.0-0.0i
Ide = A * Inv :
+1.0+0.0i -0.0-0.0i +0.0-0.0i +0.0+0.0i
-0.0-0.0i +1.0-0.0i -0.0+0.0i -0.0-0.0i
+0.0+0.0i -0.0-0.0i +1.0+0.0i +0.0-0.0i
-0.0+0.0i -0.0+0.0i +0.0-0.0i +1.0+0.0i
Press return to continue
Press X return to stop