Linear Algebra and the C Language/a0db


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as:  c00b.c                    */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A      = rsymmetric_mR(   i_mR(r,r),9);
double **EValue =       eigs_mR(A, i_mR(r,C1));

double p = 1;
int    i = 0;

  clrscrn();

  printf(" A:");
  p_mR(A,S2,P0,C6);
       
  printf(" EValue:");
  p_mR(eigs_mR(A,EValue),S13,P6,C1);   
  
  for(i=R1;i<=r;i++)
  
       p *= EValue[i][C1];
        
  printf(" Product of the eigenvalues of A: %.3f    \n",        p); 
  printf(" Determinant of A               : %.3f\n\n\n", det_R(A));
   
  f_mR(A);
  f_mR(EValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun(rp_I(R4)+R2);

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Screen output example:

                                                                                       
 A :
-7 +5 -9 -6 
+5 -4 -2 -5 
-9 -2 -6 -9 
-6 -5 -9 -8 

 EigsValue :
   -23.131710 
    -9.905380 
    +5.343318 
    +2.693772 

 Product of the eigenvalues of A : 3298.000    
 Determinant of A                : 3298.000



 Press   return to continue
 Press X return to stop