Linear Algebra and the C Language/a006


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A        =       r_mR(   i_mR(r,r),9.);
double **Aadjoint = adjoint_mR(A, i_mR(r,r)   );

  clrscrn();
  printf(" A :");
  p_mR(A,S3,P0,C6);
  
  printf(" adjoint(A) :");
  p_mR(Aadjoint,S6,P0,C6);

  printf(" det(adjoint(A)) = %+.0f\n",     det_R(Aadjoint)       );
  printf(" det(A)**(r-R1)  = %+.0f\n", pow(det_R(A),     (r-R1)));

  
  f_mR(A);
  f_mR(Aadjoint);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC4)+C1);

} while(stop_w());

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


Screen output example:

 A :
 +3  -2  -6 
 +4  -9  +7 
 +7  +7  +7 

 adjoint(A) :
  -112    -28    -68 
   +21    +63    -45 
   +91    -35    -19 

 det(adjoint(A)) = +853776
 det(A)**(r-R1)  = +853776

 Press   return to continue
 Press X return to stop