Linear Algebra and the C Language/a05g
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : cofm_r.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR( i_mR(r,r),9.);
double **Cofactor = cofactor_mR(A, i_mR(r,r));
clrscrn();
printf(" A:");
p_mR(A, S5,P0,C6);
printf(" Cofactor:");
p_mR(Cofactor, S8,P0,C6);
f_mR(A);
f_mR(Cofactor);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(RC5)+RC1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
-5 +6 -9
-1 -4 +6
+1 -9 +6
Cofactor :
+30 +12 +13
+45 -21 -39
+0 +39 +26
Press return to continue
Press X return to stop