Linear Algebra and the C Language/a003


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));
double **VxU = UxV_mR(V_T,U_T,i_mR(R1,C3));

  clrscrn();       
  printf("  u_T:");
  p_mR(U_T, S3,P0,C6);
  printf("  v_T:");
  p_mR(V_T, S3,P0,C6);
  
  printf("    u x v: ");    
  p_mR(UxV, S5,P0,C6); 
  printf("    v x u: ");    
  p_mR(VxU, S5,P0,C6); 
  
  f_mR(U_T); 
  f_mR(V_T);
  f_mR(UxV);  
  f_mR(VxU);   
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
do
{  
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
u x v == - v x u: 

Screen output example:

  u_T  :
 +4  -2  -4 

  v_T  :
 +4  -8  -7 

    u x v : 
  -18   +12   -24 

    v x u : 
  +18   -12   +24 


 Press   return to continue
 Press X return to stop