Linear Algebra and the C Language/a0ht
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A = rlower_mR(i_mR(rc,rc),9);
double **B = rlower_mR(i_mR(rc,rc),9);
double **AB = i_mR(rc,rc);
clrscrn();
printf(" A:");
p_mR(A, S4,P0,C6);
printf(" B:");
p_mR(B, S4,P0,C6);
printf(" AB:");
p_mR(mul_mR(A,B,AB), S4,P0,C6);
f_mR(A);
f_mR(B);
f_mR(AB);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(RC3)+RC1);
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Multiplying lower triangular matrices
Screen output example:
A:
-7 +0 +0 +0
+8 -9 +0 +0
+9 -8 +1 +0
+5 +5 +5 +3
B:
+4 +0 +0 +0
+1 +6 +0 +0
-8 +7 -6 +0
+4 +8 -5 +2
AB:
-28 +0 +0 +0
+23 -54 +0 +0
+20 -41 -6 +0
-3 +89 -45 +6
Press return to continue
Press X return to stop