Linear Algebra and the C Language/a0m0
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c02a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA R4
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+5.701637292731, +0.991969965586, +0.254041088748, +1.125039107310,
+0.991969965586, +6.402440296173, +0.359161539264, +1.590572531025,
+0.254041088748, +0.359161539264, +5.091980394202, +0.407341745750,
+1.125039107310, +1.590572531025, +0.407341745750, +6.803942016894
};
double **A = ca_A_mR(a, i_mR(RCA,RCA));
double **EValue = eigs_mR(A, i_mR(RCA,R1));
clrscrn();
printf(" The eigenvectors associated with eigenvalues\n"
" with multiple multiplicity are not unique. \n"
" There exist several set of unit vectors that\n"
" correspond to the same eigenspace. \n\n\n"
" Copy/Paste into the octave windows\n\n");
p_Octave_mR(A,"a",P9);
printf(" [V, E] = eigs (a,%d) \n\n",RCA);
printf(" EValue:");
p_mR(EValue,S10,P3,C10);
stop();
f_mR(A);
f_mR(EValue);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
The eigenvectors associated with eigenvalues
with multiple multiplicity are not unique.
There exist several set of unit vectors that
correspond to the same eigenspace.
Copy/Paste into the octave windows
a=[
+5.701637293,+0.991969966,+0.254041089,+1.125039107;
+0.991969966,+6.402440296,+0.359161539,+1.590572531;
+0.254041089,+0.359161539,+5.091980394,+0.407341746;
+1.125039107,+1.590572531,+0.407341746,+6.803942017]
[V, E] = eigs (a,4)
EValue:
+9.000
+5.000
+5.000
+5.000
Press return to continue.