Linear Algebra and the C Language/a06t
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00e.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR(i_mR(r,r),9.);
double **B = i_mR(r,r);
double s = r_I(9);
int c = rp_I(A[C_SIZE][C0]-C1);
clrscrn();
printf(" A:");
p_mR(A,S3,P0,C6);
printf(" The column[%d] of A is muliply by %+.3f:\n",c,s);
printf(" B:");
p_mR( mulC_mR(c_mR(A,B),s,c),S3,P0,C6);
printf(" If B is the matrix that results when \n");
printf(" a single column of A is muliplied by \n");
printf(" a scalar s, then det(B) = s det(A) \n\n");
printf(" det_R(B) = %+.0f\n", det_R(B));
printf(" %+.0f det_R(A) = %+.0f\n",s,s*det_R(A));
printf(" det_R(A) = %+.0f\n", det_R(A));
f_mR(A);
f_mR(B);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(RC3)+RC1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A:
+3 +3 -6
+6 -4 -4
-1 +7 +9
The column[3] of A is muliply by +6.000:
B:
+3 +3 -36
+6 -4 -24
-1 +7 +54
If B is the matrix that results when
a single column of A is muliplied by
a scalar s, then det(B) = s det(A)
det_R(B) = -2412
+6 det_R(A) = -2412
det_R(A) = -402
Press return to continue
Press X return to stop