Linear Algebra and the C Language/a0mx
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c02a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RA R2
#define CA C2
#define RX R2
#define CX C1
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double x_B[RX*CX]={
+1,
+2
};
double b[RA*CA]={
+2, +4,
+3, +5
};
double **B = ca_A_mR(b, i_mR(RA,CA));
double **x_b = ca_A_mR(x_B, i_mR(RX,CX));
double **x_s = mul_mR(B,x_b, i_mR(RX,CX));
clrscrn();
printf(" B is the base change matrix for base \"B\" \n\n"
" B :");
p_mR(B,S8,P2,C7);
printf(" x_b: (x_b = InvB x_s) (x in the base \"B\")");
p_mR(x_b,S8,P2,C7);
printf(" x_s: (x_s = B x_b) (x in the Standard basis)");
p_mR(x_s,S8,P2,C7);
stop();
f_mR(B);
f_mR(x_b);
f_mR(x_s);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
B is the base change matrix for base "B"
B :
+2.00 +4.00
+3.00 +5.00
x_b: (x_b = InvB x_s) (x in the base "B")
+1.00
+2.00
x_s: (x_s = B x_b) (x in the Standard basis)
+10.00
+13.00
Press return to continue.