Mathc complexes/a323
Apparence
Décomposition d'une matrice en éléments propres
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* save as : c00b.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 **XC1 = c_D_U_mZ(X, i_mZ(rc,C1));
clrscrn();
printf(" Copy/Past into the octave windows \n\n\n");
p_Octave_mZ(A,"A",P0,P0);
printf(" EigenValues = eigs (A,%d) \n\n\n",rc);
printf(" A :");
p_mZ(A, S8,P0, S7,P0, C4);
stop();
clrscrn();
printf(" U :");
p_mZ(U, S10,P4, S8,P4, C4);
printf(" X = U_T * A * U :");
p_mZ(X, S11,P3, S7,P3, C4);
printf(" EigenValues :");
p_mZ(XC1, S12,P4, S9,P4, C4);
f_mZ(A);
f_mZ(A_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(X);
f_mZ(XC1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
Copy/Past into the octave windows
A=[
+16138+0*i,+2203-2143*i,-794+10878*i,+10430+2650*i;
+2203+2143*i,+25472+0*i,-9632-9839*i,-10103-2575*i;
-794-10878*i,-9632+9839*i,+25928+0*i,+15808-14423*i;
+10430-2650*i,-10103+2575*i,+15808+14423*i,+34542+0*i]
EigenValues = eigs (A,4)
A :
+16138 +0i +2203 -2143i -794 +10878i +10430 +2650i
+2203 +2143i +25472 +0i -9632 -9839i -10103 -2575i
-794 -10878i -9632 +9839i +25928 +0i +15808 -14423i
+10430 -2650i -10103 +2575i +15808 +14423i +34542 +0i
Press return to continue.
U :
+0.2126 +0.1566i +0.4637 -0.3074i -0.4170 -0.3233i -0.2144 +0.5445i
-0.3838 -0.0292i +0.6120 -0.4106i +0.1123 +0.4653i -0.0894 -0.2677i
+0.4231 -0.4098i -0.1249 +0.0324i -0.0005 +0.4229i -0.6735 +0.0628i
+0.6597 +0.0000i +0.3616 -0.0000i +0.5600 +0.0000i +0.3470 -0.0000i
X = U_T * A * U :
+63620.091 +0.000i +0.000 -0.000i +0.000 +0.000i +0.000 -0.000i
+0.000 +0.000i +24735.159 -0.000i +0.000 +0.000i +0.000 -0.000i
+0.000 -0.000i +0.000 -0.000i +10176.425 -0.000i -0.000 -0.000i
-0.000 +0.000i +0.000 +0.000i -0.000 +0.000i +3548.325 +0.000i
EigenValues :
+63620.0908 +0.0000i
+24735.1590 -0.0000i
+10176.4250 -0.0000i
+3548.3253 +0.0000i
Press return to continue
Press X return to stop