Linear Algebra and the C Language/a05j


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define    RA  R3
#define    CA  C3
/* ------------------------------------ */
int main(void)
{
double a[RA*CA] ={ 4,2,3,
                   5,3,1,
                   8,2,2};
                   
double **A        =     ca_A_mR(a, i_mR(RA,CA));
double **Cofactor = cofactor_mR(A, i_mR(RA,CA)) ;
double **Adjoint  =  adjoint_mR(A, i_mR(RA,CA));

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

  printf(" Cofactor :\n");
  p_mR(Cofactor,S6,P0,C6);
  
  printf(" Adjoint : Cofactor_T");
  p_mR(Adjoint,S6,P0,C6);
  stop();

  f_mR(A);
  f_mR(Cofactor);
  f_mR(Adjoint);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Screen output example:

 A :
 +4  +2  +3 
 +5  +3  +1 
 +8  +2  +2 

 Cofactor :

    +4     -2    -14 
    +2    -16     +8 
    -7    +11     +2 

 Adjoint : Cofactor_T
    +4     +2     -7 
    -2    -16    +11 
   -14     +8     +2 

 Press return to continue.