Linear Algebra and the C Language/a05b


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)
{
int minor_r = R1;
int minor_c = C1;

double a[RA*CA] ={ 4,2,3,
                   5,3,1,
                   8,2,2};
        
double **A     =  ca_A_mR(a, i_mR(RA,   CA   ));
double **Minor = minor_mR(A, i_mR(RA-C1,CA-C1),minor_r,minor_c);

  clrscrn();
  printf(" A:");
  p_mR(A, S5,P0,C6);
  printf(" Minor(R%d,C%d) %.4e \n\n\n",
          minor_r,
          minor_c,
          minor_R(A,minor_r, minor_c));

  printf(" Copy/Paste into the octave window.\n\n");
  p_Octave_mR(Minor,"Minor",P0);
  printf(" det(Minor)\n\n\n");
  stop();

  f_mR(A);
  f_mR(Minor);

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


Screen output example:

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

 Minor(R1,C1) 4.0000e+00 


 Copy/Paste into the octave window.

 Minor=[
+3,+1;
+2,+2]

 det(Minor)


 Press return to continue.