Linear Algebra and the C Language/a05a


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   minor_r.c               */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A     = r_mR(i_mR(r,r),999.);
double **Minor = i_mR(r-C1,r-C1);

int minor_r = rp_I(r);
int minor_c = rp_I(r);

  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/Past into the octave window.\n\n");
  p_Octave_mR(minor_mR(A, Minor, minor_r, minor_c),"Minor",P0);
  printf(" det(Minor)\n");

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

  srand(time(&t));

do
{
  fun(rp_I(RC5)+RC1);

} while(stop_w());

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


Screen output example:

 A :
 -738  +205  +822   +57  +642  -949 
 -961  -551  +912  -145  -843  -995 
  -79  -593  +444  -293  -760  -429 
 +633  -841  +408  -177  -799  -932 
  +96  +168  -447  +655  -160  -540 
 -685  +503  -485   +27  +853  -830 

 Minor(R4,C1) 1.3565e+14 


 Copy/Past into the octave window.

 Minor=[
+205,+822,+57,+642,-949;
-551,+912,-145,-843,-995;
-593,+444,-293,-760,-429;
+168,-447,+655,-160,-540;
+503,-485,+27,+853,-830]

 det(Minor)

 Press   return to continue
 Press X return to stop