Mathc complexes/a321
Décomposition d'une matrice en éléments propres
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-4
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = rcsymmetric_mZ( i_mZ(rc,rc),9);
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 **UX = mul_mZ(U, X, i_mZ(rc,rc));
mul_mZ(UX, U_T, A);
clrscrn();
printf(" A :");
p_mZ(A, S8,P1, S7,P1, C4);
printf(" U :");
p_mZ(U, S9,P4, S8,P4, C4);
printf(" X = U_T * A * U :");
p_mZ(X, S9,P4, S8,P4, C4);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S8,P1, S7,P1, C4);
printf(" A = U * X * U_T ");
p_mZ(A, S8,P1, S7,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(UX);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+74.0 -0.0i +12.0 -42.0i +30.0 +28.0i +27.0 +41.0i
+12.0 +42.0i +247.0 +0.0i -8.0 +82.0i -107.0 +5.0i
+30.0 -28.0i -8.0 -82.0i +290.0 +0.0i -53.0 +277.0i
+27.0 -41.0i -107.0 -5.0i -53.0 -277.0i +341.0 -0.0i
U :
-0.0106 +0.1008i +0.1685 -0.1465i +0.7953 +0.0918i -0.5341 -0.1171i
-0.3220 -0.0209i +0.7741 +0.4583i +0.0011 -0.2854i +0.0715 +0.0087i
-0.0938 +0.6225i -0.2565 +0.1373i +0.0759 -0.3890i +0.1732 -0.5761i
+0.6995 +0.0000i +0.2371 +0.0000i +0.3472 +0.0000i +0.5779 -0.0000i
X = U_T * A * U :
+649.2434 +0.0000i -0.0000 -0.0000i +0.0000 -0.0000i +0.0000 -0.0000i
-0.0000 +0.0000i +212.8996 +0.0000i +0.0000 +0.0000i -0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 -0.0000i +87.2939 +0.0000i +0.0000 -0.0000i
-0.0000 -0.0000i -0.0000 -0.0000i +0.0000 +0.0000i +2.5631 +0.0000i
Press return to continue.
A :
+74.0 -0.0i +12.0 -42.0i +30.0 +28.0i +27.0 +41.0i
+12.0 +42.0i +247.0 +0.0i -8.0 +82.0i -107.0 +5.0i
+30.0 -28.0i -8.0 -82.0i +290.0 +0.0i -53.0 +277.0i
+27.0 -41.0i -107.0 -5.0i -53.0 -277.0i +341.0 -0.0i
A = U * X * U_T
+74.0 -0.0i +12.0 -42.0i +30.0 +28.0i +27.0 +41.0i
+12.0 +42.0i +247.0 +0.0i -8.0 +82.0i -107.0 +5.0i
+30.0 -28.0i -8.0 -82.0i +290.0 +0.0i -53.0 +277.0i
+27.0 -41.0i -107.0 -5.0i -53.0 -277.0i +341.0 -0.0i
Press return to continue
Press X return to stop