Linear Algebra and the C Language/a09r
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00f.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RAb R4
#define CA C4
#define Cb C1
/* ------------------------------------ */
# define FREEV C3
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double ab[RAb*(CA+C1)]={
-1888.0, +674.0, -1554.0, -262.0, -1184.0,
+2832.0, -1011.0, +2331.0, +393.0, +1776.0,
-944.0, +337.0, -777.0, -131.0, -592.0,
-3776.0, +1348.0, -3108.0, -524.0, -2368.0
};
double **Ab = ca_A_mR(ab, i_Abr_Ac_bc_mR(RAb, CA, Cb));
double **Ab_free = i_Abr_Ac_bc_mR(CA, CA, Cb + FREEV);
double **b_free = i_mR(CA, Cb + FREEV);
clrscrn();
printf(" Ab :");
P_mR(Ab, S10,P4,C10);
printf(" Ab : gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab, S10,P4,C10);
stop();
clrscrn();
put_zeroR_mR(Ab,Ab_free);
printf(" Ab_free : put_zeroR_mR(Ab,Ab_free);");
p_mR(Ab_free, S8,P4,C10);
put_freeV_mR(Ab_free);
printf(" Ab_free : put_freeV_mR(Ab_free);");
p_mR(Ab_free, S8,P4,C10);
printf(" Ab_free : gj_PP_mR(Ab_free,YES);");
gj_PP_mR(Ab_free,YES);
p_mR(Ab_free, S8,P4,C10);
stop();
clrscrn();
c_Ab_b_mR(Ab_free,b_free);
printf(" b_free :");
p_mR(b_free, S8,P4,C7);
printf(" b FREEV");
p_freeV(b_free, S8,P4);
stop();
f_mR(Ab);
f_mR(Ab_free);
f_mR(b_free);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Ab :
-1888.0000, +674.0000, -1554.0000, -262.0000, -1184.0000,
+2832.0000, -1011.0000, +2331.0000, +393.0000, +1776.0000,
-944.0000, +337.0000, -777.0000, -131.0000, -592.0000,
-3776.0000, +1348.0000, -3108.0000, -524.0000, -2368.0000
Ab : gj_PP_mR(Ab,NO) :
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000
Press return to continue.
Ab_free : put_zeroR_mR(Ab,Ab_free);
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000
Ab_free : put_freeV_mR(Ab_free);
+1.0000 -0.3570 +0.8231 +0.1388 +0.6271 +0.0000 +0.0000 +0.0000
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000
Ab_free : gj_PP_mR(Ab_free,YES);
+1.0000 +0.0000 +0.0000 +0.0000 +0.6271 +0.3570 -0.8231 -0.1388
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000
Press return to continue.
b_free :
+0.6271 +0.3570 -0.8231 -0.1388
+0.0000 +1.0000 +0.0000 +0.0000
+0.0000 +0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +0.0000 +1.0000
b FREEV
x1 = +0.6271 +0.3570*u -0.8231*v -0.1388*w
x2 = +0.0000 +1.0000*u +0.0000*v +0.0000*w
x3 = +0.0000 +0.0000*u +1.0000*v +0.0000*w
x4 = +0.0000 +0.0000*u +0.0000*v +1.0000*w
Press return to continue.