Linear Algebra and the C Language/a05d


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   minorm_r.c              */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
int minor_r = rp_I(r);
int minor_c = rp_I(r);

double **A     =     r_mR(   i_mR(r,   r   ),99);
double **Minor = minor_mR(A, i_mR(r-C1,r-C1),minor_r,minor_c);

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

  printf(" Minor(R%d,C%d):\n",minor_r, minor_c);
  p_mR(Minor, S4,P0,C6);

  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 :
  +4   +2   +3 
  +5   +3   +1 
  +8   +2   +2 

 Minor(R1,C1) :

  +3   +1 
  +2   +2 

 Press return to continue.