Linear Algebra and the C Language/a06z
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = i_mR(r,r);
double **b = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r, r, C1);
/* i_Abr_Ac_bc_mR(R_Ab,C_A,C_b)); */
do
{
r_mR(A,999.);
printf(".");
}while(!det_R(A));
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C7);
printf(" b :");
r_mR(b,999.);
p_mR(b,S8,P0,C7);
printf(" Ab :");
c_A_b_Ab_mR(A,b,Ab);
p_mR(Ab,S8,P0,C7);
stop();
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P0);
printf("\n rref(Ab,.00000000001)\n\n");
printf(" gj_TP_mR(Ab) :");
gj_TP_mR(Ab);
p_mR(Ab,S10,P4,C7);
f_mR(Ab);
f_mR(b);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(RC5)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
-293 +33 +743 +429
+401 -332 +814 +218
+258 +324 +305 -764
-873 +764 -108 -200
b :
-931
+201
-479
-799
Ab :
-293 +33 +743 +429 -931
+401 -332 +814 +218 +201
+258 +324 +305 -764 -479
-873 +764 -108 -200 -799
Press return to continue.
Copy/Paste into the octave window.
Ab=[
-293,+33,+743,+429,-931;
+401,-332,+814,+218,+201;
+258,+324,+305,-764,-479;
-873,+764,-108,-200,-799]
rref(Ab,.00000000001)
gj_TP_mR(Ab) :
+1.0000 +0.0000 +0.0000 +0.0000 +45.7387
+0.0000 +1.0000 +0.0000 +0.0000 +60.1249
+0.0000 +0.0000 +1.0000 +0.0000 -8.0366
+0.0000 +0.0000 +0.0000 +1.0000 +38.3624
Press return to continue
Press X return to stop