Linear Algebra and the C Language/a0lu
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as: c01a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA R3
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+8.146673651126, +0.924044002095, +1.085385018334,
+0.924044002095, +13.821477213201, +6.837925615505,
+1.085385018334, +6.837925615506, +16.031849135673
};
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=[
+8.146673651,+0.924044002,+1.085385018;
+0.924044002,+13.821477213,+6.837925616;
+1.085385018,+6.837925616,+16.031849136]
[V, E] = eigs (a,3)
EValue:
+22.000
+8.000
+8.000
Press return to continue.