Linear Algebra and the C Language/a05c
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 :
+26 +71 -73 -75 +2 -9
+95 +53 +81 +33 -86 +30
-32 +9 -13 -28 +69 -37
-87 +96 -28 -95 -14 +81
-25 +17 +1 -80 +58 +10
-55 -4 +35 +62 -50 -9
Minor(R3,C2) :
+26 -73 -75 +2 -9
+95 +81 +33 -86 +30
-87 -28 -95 -14 +81
-25 +1 -80 +58 +10
-55 +35 +62 -50 -9
Press return to continue
Press X return to stop