Mathc complexes/02p
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 RC4
#define EV RC4
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double a[RCA*(RCA*C2)] ={
+1.329842932,+0.000000000, -0.125654450,-0.209424084, -0.041884817,-0.376963351, -0.041884817,+0.125654450,
-0.125654450,+0.209424084, +1.910994764,+0.000000000, -0.125654450,-0.057591623, +0.031413613,+0.036649215,
-0.041884817,+0.376963351, -0.125654450,+0.057591623, +1.785340314,+0.000000000, +0.068062827,+0.031413613,
-0.041884817,-0.125654450, +0.031413613,-0.036649215, +0.068062827,-0.031413613, +1.973821990,+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);
sub_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.329842932+0.000000000*i,-0.125654450-0.209424084*i,-0.041884817-0.376963351*i,-0.041884817+0.125654450*i;
-0.125654450+0.209424084*i,+1.910994764+0.000000000*i,-0.125654450-0.057591623*i,+0.031413613+0.036649215*i;
-0.041884817+0.376963351*i,-0.125654450+0.057591623*i,+1.785340314+0.000000000*i,+0.068062827+0.031413613*i;
-0.041884817-0.125654450*i,+0.031413613-0.036649215*i,+0.068062827-0.031413613*i,+1.973821990+0.000000000*i]
format short e
[V, E] = eigs (a,4)
Press return to continue.
zIde : EV4 * Ide
+0.10000-0.00000i +0.00000+0.00000i +0.00000+0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.10000-0.00000i +0.00000+0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.00000+0.00000i +0.10000-0.00000i +0.00000+0.00000i
+0.00000+0.00000i +0.00000+0.00000i +0.00000+0.00000i +0.10000-0.00000i
sAmnszIde : A - (EV4*Ide)
+0.03298+0.00000i -0.01257-0.02094i -0.00419-0.03770i -0.00419+0.01257i
-0.01257+0.02094i +0.09110+0.00000i -0.01257-0.00576i +0.00314+0.00366i
-0.00419+0.03770i -0.01257+0.00576i +0.07853+0.00000i +0.00681+0.00314i
-0.00419-0.01257i +0.00314-0.00366i +0.00681-0.00314i +0.09738+0.00000i
Press return to continue.
A x = b
Ab : [A-(EV4*Ide)] V4 = 0
+1.00000+0.00000i +0.18750+0.31250i -0.22866-2.05793i +0.06250-0.18750i
+0.00000+0.00000i +1.00000-0.00000i -0.58537-0.26829i +0.00000+0.00000i
+0.00000+0.00000i +0.00000+0.00000i +1.00000-0.00000i +2.60000+1.20000i
+0.00000-0.00000i +0.00000+0.00000i -0.00000+0.00000i +0.00000-0.00000i
+0.00000-0.00000i
+0.00000+0.00000i
+0.00000+0.00000i
+0.00000+0.00000i
Ab_free : [A-(EV4*Ide)] V4 = 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.00000-0.00000i +0.00000+0.00000i +0.00000+0.00000i +1.00000-0.00000i
+0.00000+0.00000i +1.60000-4.80000i
+0.00000+0.00000i -1.20000-1.40000i
+0.00000+0.00000i -2.60000-1.20000i
+0.00000+0.00000i +1.00000+0.00000i
Press return to continue.
b_free :
+0.00000+0.00000i +1.60000-4.80000i
+0.00000+0.00000i -1.20000-1.40000i
+0.00000+0.00000i -2.60000-1.20000i
+0.00000+0.00000i +1.00000+0.00000i
V4 : Copy V4 into the next file
-nan, -nan, -nan, -nan, -nan, -nan, +0.258873923,-0.776621761,
-nan, -nan, -nan, -nan, -nan, -nan, -0.194155440,-0.226514681,
-nan, -nan, -nan, -nan, -nan, -nan, -0.420670121,-0.194155442,
-nan, -nan, -nan, -nan, -nan, -nan, +0.161796200,+0.000000000
Press return to continue.