Linear Algebra and the C Language/a0jf
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double s = 5;
double u_T[R1*C3] = { 4, 2, 5};
double v_T[R1*C3] = { 3, 4, 1};
double **U_T = ca_A_mR(u_T , i_mR(R1, C3));
double **V_T = ca_A_mR(v_T , i_mR(R1, C3));
double **sU_T = smul_mR(s,U_T, i_mR(R1, C3));
double **sV_T = smul_mR(s,V_T, i_mR(R1, C3));
double **UxV_T = UxV_mR(U_T,V_T, i_mR(R1,C3));
double **s_UxV_T = smul_mR(s,UxV_T, i_mR(R1, C3));
double **sUxV_T = UxV_mR(sU_T,V_T, i_mR(R1,C3));
double **UxsV_T = UxV_mR(U_T,sV_T, i_mR(R1,C3));
clrscrn();
printf(" s = %+.0f\n\n",s);
printf(" u_T:");
p_mR(U_T, S4,P0,C6);
printf(" v_T:");
p_mR(V_T, S4,P0,C6);
printf("\n"
" s (uxv) == su x v == u x sv\n\n"
" s (uxv):");
p_mR(s_UxV_T, S5,P0,C6);
printf(" su x v:");
p_mR(sUxV_T, S5,P0,C6);
printf(" u x sv:");
p_mR(UxsV_T, S5,P0,C6);
stop();
f_mR(U_T);
f_mR(V_T);
f_mR(sU_T);
f_mR(sV_T);
f_mR(UxV_T);
f_mR(s_UxV_T);
f_mR(sUxV_T);
f_mR(UxsV_T);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
s (uxv) == su x v == u x sv:
Screen output example:
s = +5
u_T:
+4 +2 +5
v_T:
+3 +4 +1
s (uxv) == su x v == u x sv
s (uxv):
-90 +55 +50
su x v:
-90 +55 +50
u x sv:
-90 +55 +50
Press return to continue.