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

/* ------------------------------------ */
/* Save as : c00c.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RA R8
#define CA C6
#define Cb C1
/* ------------------------------------ */
#define FACTOR_E +1.E-1
/* ------------------------------------ */
int main(void)
{
double ta[RA*(CA+Cb)]={
// I1 I2 I3 I4 I5 I6
-1, +1, +1, +0, +0, +0,
+0, +0, -1, +1, -1, +0,
+0, +0, +0, -1, +1, +1,
+1, -1, +0, +0, +0, -1,
+15, +60, +0, +0, +0, +0,
+0, -60, +15, +15, +0, +15,
+0, +0, +0, -15, -60, +0,
+15, +0, +15, +0, -60, +15
};
double tb[RA*(CA+Cb)]={
+0,
+0,
+0,
+0,
+90,
+0,
-90,
+0
};
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);
stop();
clrscrn();
printf(" Pinv = V * invS_T * U_T ");
Pinv_Rn_mR(A,Pinv,FACTOR_E);
pE_mR(Pinv,S12,P4,C5);
printf(" x = Pinv * b ");
mul_mR(Pinv,b,x);
p_mR(x,S10,P4,C5);
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 +0.0 +0.0 +0.0
+0.0 +0.0 -1.0 +1.0 -1.0 +0.0
+0.0 +0.0 +0.0 -1.0 +1.0 +1.0
+1.0 -1.0 +0.0 +0.0 +0.0 -1.0
+15.0 +60.0 +0.0 +0.0 +0.0 +0.0
+0.0 -60.0 +15.0 +15.0 +0.0 +15.0
+0.0 +0.0 +0.0 -15.0 -60.0 +0.0
+15.0 +0.0 +15.0 +0.0 -60.0 +15.0
b :
+0.0
+0.0
+0.0
+0.0
+90.0
+0.0
-90.0
+0.0
Press return to continue.
Pinv = V * invS_T * U_T
-3.1111e-01 -8.8889e-02 +8.8889e-02 +3.1111e-01 +1.4444e-02
+7.7778e-02 +2.2222e-02 -2.2222e-02 -7.7778e-02 +8.8889e-03
+3.6111e-01 -3.6111e-01 -1.3889e-01 +1.3889e-01 +5.5556e-03
+8.8889e-02 +3.1111e-01 -3.1111e-01 -8.8889e-02 +7.7778e-03
-2.2222e-02 -7.7778e-02 +7.7778e-02 +2.2222e-02 +2.2222e-03
-1.3889e-01 +1.3889e-01 +3.6111e-01 -3.6111e-01 +5.5556e-03
+4.0741e-03 -7.7778e-03 +1.0741e-02
-5.1852e-03 -2.2222e-03 +1.4815e-03
+9.2593e-03 -5.5556e-03 +9.2593e-03
+1.0741e-02 -1.4444e-02 +4.0741e-03
+1.4815e-03 -8.8889e-03 -5.1852e-03
+9.2593e-03 -5.5556e-03 +9.2593e-03
x = Pinv * b
+2.0000
+1.0000
+1.0000
+2.0000
+1.0000
+1.0000
Press return to continue.