Mathc matrices/02t
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rdefinite_positive_mR( i_mR(r,r), 99);
double **V = i_mR(r,r);
double **EValue = i_mR(r,C1);
clrscrn();
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mR(A,"a",P9);
printf(" [V, E] = eigs (a,%d) \n\n",r);
printf(" V:");
eigs_V_mR(A,V);
p_mR(V,S9,P6,C6);
printf(" EValue :");
eigs_mR(A,EValue);
p_mR(EValue,S10,P5,C6);
f_mR(A);
f_mR(V);
f_mR(EValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vérifions avec octave
Exemple de sortie écran :
a=[
+43.533992210,+5.623499235,-9.525564937,-35.461140735;
+5.623499235,+68.953614101,+4.346703098,+7.799773586;
-9.525564937,+4.346703098,+61.410131437,-15.725158476;
-35.461140735,+7.799773586,-15.725158476,+55.102262252]
[V, E] = eigs (a,4)
V:
-0.567263 +0.043039 -0.438580 +0.695707
+0.099342 +0.937347 -0.292387 -0.161309
-0.250230 +0.344985 +0.849749 +0.310317
+0.778286 +0.022641 -0.009137 +0.627435
EValue :
+87.00000
+71.00000
+65.00000
+6.00000
Press return to continue
Press X return to stop