Mathc matrices/048
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC4
/* ------------------------------------ */
#define EV R1
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+9.387051138013, +1.478424899325, +0.973685336456, -0.700350180421,
+1.478424899325, +9.614194406175, +0.773429774749, -1.033063523876,
+0.973685336456, +0.773429774749, +10.505111304292, +1.482769644746,
-0.700350180421, -1.033063523876, +1.482769644746, +10.493643151520
};
double **A = ca_A_mR(a, i_mR(RCA,RCA));
double **EValue = eigs_mR(A, i_mR(RCA,RCA));
double **Ide = eye_mR( i_mR(RCA,RCA));
double **sIde = i_mR(RCA,RCA);
double **AmnssIde = i_mR(RCA,RCA);
double **Ab = i_Abr_Ac_bc_mR(RCA,RCA,C1);
double **b = i_mR(RCA,C1);
double **Ab_free = i_Abr_Ac_bc_mR(RCA,RCA,RCA);
double **b_free = i_mR(RCA,RCA);
double **V = i_mR(RCA,RCA);
clrscrn();
printf(" A :");
p_mR(A,S10,P5,C10);
smul_mR(EValue[EV][C1],Ide,sIde);
MmnsD_mR(A,sIde,AmnssIde);
c_A_b_Ab_mR(AmnssIde,b,Ab);
gj_PP_mR(Ab,NO);
put_zeroR_mR(Ab,Ab_free);
put_freeV_mR(Ab_free);
gj_PP_mR(Ab_free,YES);
c_Ab_b_mR(Ab_free,b_free);
c_c_mR(b_free,C2,V,EV);
c_c_mR(b_free,C3,V,EV+C1);
Normalize_mR(V);
printf(" V%d : Copy V%d into the last file",EV,EV);
P_mR(V,S10,P12,C10);
stop();
f_mR(A);
f_mR(EValue);
f_mR(Ide);
f_mR(sIde);
f_mR(AmnssIde);
f_mR(Ab);
f_mR(b);
f_mR(Ab_free);
f_mR(b_free);
f_mR(V);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Calculer les deux premiers vecteurs propres
Exemple de sortie écran :
A :
+9.38705 +1.47842 +0.97369 -0.70035
+1.47842 +9.61419 +0.77343 -1.03306
+0.97369 +0.77343 +10.50511 +1.48277
-0.70035 -1.03306 +1.48277 +10.49364
V1 : Copy V1 into the last file
+0.545516920109, -0.502145306797, -nan, -nan,
+0.544568195031, -0.586388346015, -nan, -nan,
+0.637068890180, +0.000000000000, -nan, -nan,
+0.000000000000, +0.635608998142, -nan, -nan
Press return to continue.