Linear Algebra and the C Language/a0ln
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as: c04b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R2
#define CA C4
#define Cb C1
/* ------------------------------------ */
int main(void)
{
double a_Tb[RA*(CA+Cb)]={
2,0,0,4,0,
0,3,0,5,0
};
double **A_Tb = ca_A_mR(a_Tb, i_Abr_Ac_bc_mR(RA,CA,Cb));
double **A_T = c_Ab_A_mR(A_Tb, i_mR(RA,CA));
double **b = c_Ab_b_mR(A_Tb, i_mR(RA,Cb));
clrscrn();
printf(" Verify if AT is a basis for a Row Space by Row Reduction.\n\n"
" A_T:");
p_mR(A_T,S6,P1,C10);
printf(" b:");
p_mR(b,S6,P1,C10);
printf(" A_Tb:");
p_mR(A_Tb,S6,P1,C10);
stop();
clrscrn();
printf(" The nonzero row vectors of A_Tb form a basis\n"
" for the row space of A_T, and hence form a \n"
" basis for the column space of A \n\n"
" A_Tb:");
p_mR(A_Tb,S7,P3,C10);
printf(" A_Tb: gj_PP_mR(A_Tb,NO);");
p_mR(gj_PP_mR(A_Tb,NO),S7,P3,C10);
stop();
f_mR(A_Tb);
f_mR(b);
f_mR(A_T);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Verify if AT is a basis for a Row Space by Row Reduction.
A_T:
+2.0 +0.0 +0.0 +4.0
+0.0 +3.0 +0.0 +5.0
b:
+0.0
+0.0
A_Tb:
+2.0 +0.0 +0.0 +4.0 +0.0
+0.0 +3.0 +0.0 +5.0 +0.0
Press return to continue.
The nonzero row vectors of A_Tb form a basis
for the row space of A_T, and hence form a
basis for the column space of A
A_Tb:
+2.000 +0.000 +0.000 +4.000 +0.000
+0.000 +3.000 +0.000 +5.000 +0.000
A_Tb: gj_PP_mR(A_Tb,NO);
+1.000 +0.000 +0.000 +2.000 +0.000
+0.000 +1.000 +0.000 +1.667 +0.000
Press return to continue.