Linear Algebra and the C Language/a0da
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rsymmetric_mR( i_mR(r,r),999.);
double **EigsValue = eigs_mR(A, i_mR(r,C1));
double s = 0;
int i = 0;
clrscrn();
printf(" A :");
p_mR(A,S4,P0,C6);
printf(" EigsValue :");
p_mR(EigsValue,S13,P6,C1);
for(i=R1;i<=r;i++)
s += EigsValue[i][C1];
printf(" Sum of the eigenvalues of A : %.3f \n", s);
printf(" Trace of A : %.3f\n\n\n", trace_R(A));
f_mR(A);
f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R4)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
+484 -174 -9 -557
-174 -584 -796 +661
-9 -796 -937 +726
-557 +661 +726 +766
EigsValue :
-1934.767738
+1460.160187
+202.682446
+0.925105
Sum of the eigenvalues of A : -271.000
Trace of A : -271.000
Press return to continue
Press X return to stop