Mathc complexes/02k
Apparence
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-1
#define RCA RC3
#define EV RC1
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double a[RCA*(RCA*C2)] ={
+1.344121661,+0.000000000, -0.056736206,-0.111717684, -0.178397348,+0.422109573,
-0.056736206,+0.111717684, +1.045622928,+0.000000000, -0.107623318,-0.127510236,
-0.178397348,-0.422109573, -0.107623318,+0.127510236, +1.610255410,+0.000000000};
double **A = ca_A_mZ(a, i_mZ(RCA,RCA));
double **sA = smul_mZ(FACTOR_E, A, i_mZ(RCA,RCA));
double **EValue = eigs_mZ( sA, i_mZ(RCA,RCA));
double **V = i_mZ(RCA,RCA);
double **Ide = eye_mZ( i_mZ(RCA,RCA));
double **zIde = i_mZ(RCA,RCA);
double **sAmnszIde = i_mZ(RCA,RCA);
double **Ab = i_Abr_Ac_bc_mZ(RCA,RCA,C1);
double **b = i_mZ( RCA,C1);
double **Ab_free = i_Abr_Ac_bc_mZ(RCA,RCA,C2);
double **b_free = i_mZ( RCA,C2);
clrscrn();
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mZ(A,"a",P9,P9);
printf(" format short e\n"
" [V, E] = eigs (a,%d)\n\n", RCA);
stop();
zmul_mZ(i_Z(EValue[EV][C1],EValue[EV][C2]),Ide,zIde);
MmnsD_mZ(sA,zIde,sAmnszIde);
c_A_b_Ab_mZ(sAmnszIde,b,Ab);
GJ_PP_FreeV_mZ(Ab,Ab_free,b_free);
c_c_mZ(b_free,C2,V,EV);
Normalize_mZ(V);
clrscrn();
printf(" zIde : EV%d * Ide",EV); p_mZ(zIde, S9,P5, S8,P5, C4);
printf(" sAmnszIde : A - (EV%d*Ide)",EV); p_mZ(sAmnszIde, S9,P5, S8,P5, C4);
stop();
clrscrn();
printf(" A x = b \n"
" Ab : [A-(EV%d*Ide)] V%d = 0 ",EV,EV); p_mZ(Ab, S9,P5, S8,P5, C4);
printf(" Ab_free : [A-(EV%d*Ide)] V%d = 0 ",EV,EV); p_mZ(Ab_free, S9,P5, S8,P5, C4);
stop();
clrscrn();
printf(" b_free :"); p_mZ(b_free, S9,P5, S8,P5, C4);
printf(" V%d : Copy V%d into the next file",EV,EV); P_mZ(V, S9,P9, S8,P9, C4);
stop();
f_mZ(A);
f_mZ(V);
f_mZ(EValue);
f_mZ(Ide);
f_mZ(zIde);
f_mZ(sAmnszIde);
f_mZ(sA);
f_mZ(Ab);
f_mZ(b);
f_mZ(Ab_free);
f_mZ(b_free);
}
/* ------------------------------------ */
int main(void)
{
fun();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Calculer le dernier vecteur propre
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
+1.344121661+0.000000000*i,-0.056736206-0.111717684*i,-0.178397348+0.422109573*i;
-0.056736206+0.111717684*i,+1.045622928+0.000000000*i,-0.107623318-0.127510236*i;
-0.178397348-0.422109573*i,-0.107623318+0.127510236*i,+1.610255410+0.000000000*i]
format short e
[V, E] = eigs (a,3)
Press return to continue.
zIde : EV1 * Ide
+0.20000-0.00000i +0.00000+0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.20000-0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.00000+0.00000i +0.20000-0.00000i
sAmnszIde : A - (EV1*Ide)
-0.06559+0.00000i -0.00567-0.01117i -0.01784+0.04221i
-0.00567+0.01117i -0.09544+0.00000i -0.01076-0.01275i
-0.01784-0.04221i -0.01076+0.01275i -0.03897+0.00000i
Press return to continue.
A x = b
Ab : [A-(EV1*Ide)] V1 = 0
+1.00000+0.00000i +0.08650+0.17033i +0.27200-0.64358i +0.00000-0.00000i
+0.00000-0.00000i +1.00000+0.00000i +0.17636+0.20895i +0.00000-0.00000i
+0.00000+0.00000i -0.00000+0.00000i -0.00000+0.00000i +0.00000+0.00000i
Ab_free : [A-(EV1*Ide)] V1 = 0
+1.00000+0.00000i +0.00000+0.00000i +0.00000+0.00000i +0.00000+0.00000i
+0.00000+0.00000i +1.00000+0.00000i +0.00000+0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.00000+0.00000i +1.00000+0.00000i +0.00000+0.00000i
-0.29233+0.69169i
-0.17636-0.20895i
+1.00000+0.00000i
Press return to continue.
b_free :
+0.00000+0.00000i -0.29233+0.69169i
+0.00000+0.00000i -0.17636-0.20895i
+0.00000+0.00000i +1.00000+0.00000i
V1 : Copy V1 into the next file
-0.228366594,+0.540342817, -nan, -nan, -nan, -nan,
-0.137768700,-0.163225960, -nan, -nan, -nan, -nan,
+0.781188460,+0.000000000, -nan, -nan, -nan, -nan
Press return to continue.