411 REFERENCE · Wikibooks
Linear Algebra and the C Language/a030
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(void)
{
double **U_T = r_mR( i_mR(R1,C3), 9);
double **V_T = r_mR( i_mR(R1,C3), 9);
double **UxV = UxV_mR(U_T,V_T, i_mR(R1,C3));
clrscrn();
printf(" u_T:");
p_mR(U_T, S4, P0, C6);
printf(" v_T:");
p_mR(V_T, S4, P0, C6);
printf("\n\n"
" u x v : With UxV_mR();");
p_mR(UxV, S5, P0, C6);
f_mR(U_T);
f_mR(V_T);
f_mR(UxV);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vectors in mathematics are assumed to be column vectors, which is why I use _T (Transpose) to display row vectors.
Screen output example:
u_T:
-5 +1 -1
v_T:
-9 -3 +1
u x v : With UxV_mR();
-2 +14 +24
Press return to continue
Press X return to stop