Linear Algebra and the C Language/a06r


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),99.);
double **InvA = inv_mR(A,i_mR(r,r)    );

  clrscrn();
  printf("     A  :                det_R(A)    = %+.0f",   det_R(A)   );
  p_mR(A, S4, P0, C5);
  printf("   InvA :              1/det_R(InvA) = %+.0f",1./det_R(InvA));
  pE_mR(InvA, S12, P4, C5);

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

  srand(time(&t));
do
{
  fun(rp_I(RC3)+C2);

} while(stop_w());


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


Screen output example:

     A  :                det_R(A)    = +1095780
 -72  -90  -17 
 +48   +8  +97 
 -42  +90  +48 

   InvA :              1/det_R(InvA) = +1095780
 -7.6165e-03  +2.5461e-03  -7.8428e-03 
 -5.8205e-03  -3.8055e-03  +5.6289e-03 
 +4.2490e-03  +9.3632e-03  +3.4167e-03 


 Press   return to continue
 Press X return to stop