Linear Algebra and the C Language/a05i


Install and compile this file in your working directory.

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

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

  printf(" Cofactor :\n");
  p_mR(cofactor_mR(A,Cofactor),S6,P0,C6);
  
  printf(" Adjoint : Cofactor**T");
  p_mR(adjoint_mR(A,Adjoint),S6,P0,C6);

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

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

} while(stop_w());

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


Screen output example:

 A :
 +9  -5  +7 
 -7  -7  +3 
 +8  +6  +7 

 Cofactor :

   -67    +73    +14 
   +77     +7    -94 
   +34    -76    -98 

 Adjoint : Cofactor**T
   -67    +77    +34 
   +73     +7    -76 
   +14    -94    -98 


 Press   return to continue
 Press X return to stop