Linear Algebra and the C Language/a0j3
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC3
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+2.210333368648, +0.143493589514, -0.479053581306,
+0.143493589514, +1.867084911061, -0.846148442989,
-0.479053581306, -0.846148442989, +1.922581720291
};
double **A = ca_A_mR(a, i_mR(RCA,RCA));
double **EigsValue = eigs_mR(A, i_mR(RCA,C1));
clrscrn();
printf(" Copy/Paste into the octave windows \n\n");
p_Octave_mR(A,"a",P12);
printf(" EigenValues = eigs (a,%d) \n\n",RCA);
printf(" EigenValues:");
p_mR(EigsValue, S13,P3,C1);
stop();
f_mR(A);
f_mR(EigsValue);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Copy/Paste into the octave windows
a=[
+2.210333368648,+0.143493589514,-0.479053581306;
+0.143493589514,+1.867084911061,-0.846148442989;
-0.479053581306,-0.846148442989,+1.922581720291]
EigenValues = eigs (a,3)
EigenValues:
+3.000
+2.000
+1.000
Press return to continue.