Linear Algebra and the C Language/a0df
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00f.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double p = rp_I(3)+1;
double **A = rsymmetric_mR( i_mR(r, r),9.);
double **EigsValueA = eigs_mR(A, i_mR(r,C1));
double **A_p = pow_mR(p,A,i_mR(r, r));
double **EigsValueA_p = eigs_mR(A_p,i_mR(r,C1));
int i = 0;
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" EigsValue :");
p_mR(EigsValueA,S13,P6,C1);
printf(" A_%.0f :",p);
p_mR(A_p,S8,P0,C6);
printf(" EigsValueA_%.0f :",p);
p_mR(EigsValueA_p,S15,P6,C1);
stop();
clrscrn();
printf(" EigsValue A_%.0f :",p);
p_mR(EigsValueA_p,S15,P6,C1);
printf(" (EigsValues of A)**%.0f * :\n",p);
for(i=R1;i<=r;i++)
printf(" %+14.6f \n", pow(EigsValueA[i][C1],p));
f_mR(A);
f_mR(EigsValueA);
f_mR(A_p);
f_mR(EigsValueA_p);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
-5 +3 +1 +4
+3 -9 -1 -1
+1 -1 +7 -8
+4 -1 -8 -3
EigsValue :
-12.748953
+11.522728
-7.051600
-1.722175
A_4 :
+7748 -8526 -4928 -6676
-8526 +11866 +3378 +7494
-4928 +3378 +15212 -3700
-6676 +7494 -3700 +11702
EigsValueA_4 :
+26417.883622
+17628.738095
+2472.581791
+8.796491
Press return to continue.
EigsValue A_4 :
+26417.883622
+17628.738095
+2472.581791
+8.796491
(EigsValues of A)**4 * :
+26417.883622
+17628.738095
+2472.581791
+8.796491
Press return to continue
Press X return to stop