Linear Algebra and the C Language/a04m
Install and compile this file in your working directory.

/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RA R4
#define CA C3
#define Cb C1
/* ------------------------------------ */
#define FACTOR_E +1.E-0
/* ------------------------------------ */
int main(void)
{
double ta[RA*(CA+Cb)]={
// I1 I2 I3
+1, +1, -1,
-60, +30, +0,
+0, +30, +20,
+60, +0, +20,
};
double tb[RA*(CA+Cb)]={
// I1 I2 I3
+0,
+0,
+120,
+120
};
double **A = ca_A_mR(ta,i_mR(RA,CA));
double **b = ca_A_mR(tb,i_mR(RA,C1));
double **Pinv = i_mR(CA,RA);
double **x = i_mR(CA,C1);
clrscrn();
printf(" A :");
p_mR(A,S5,P1,C6);
printf(" b :");
p_mR(b,S5,P1,C6);
printf(" Pinv = V * invS_T * U_T ");
Pinv_Rn_mR(A,Pinv,FACTOR_E);
pE_mR(Pinv,S12,P4,C6);
printf(" x = Pinv * b ");
mul_mR(Pinv,b,x);
p_mR(x,S10,P4,C6);
stop();
f_mR(b);
f_mR(A);
f_mR(Pinv);
f_mR(x);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:
A :
+1.0 +1.0 -1.0
-60.0 +30.0 +0.0
+0.0 +30.0 +20.0
+60.0 +0.0 +20.0
b :
+0.0
+0.0
+120.0
+120.0
Pinv = V * invS_T * U_T
+1.6667e-01 -6.4815e-03 +9.2593e-04 +7.4074e-03
+3.3333e-01 +9.2593e-03 +1.2963e-02 +3.7037e-03
-5.0000e-01 +2.7778e-03 +1.3889e-02 +1.1111e-02
x = Pinv * b
+1.0000
+2.0000
+3.0000
Press return to continue.