Linear Algebra and the C Language/a09g


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as:   c00b.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RAb  R2
#define   CA   C6
#define   Cb   C1
/* ------------------------------------ */
# define FREEV C5
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double ab[RAb*(CA+C1)]={
     -18, -549, -119, -715, -233, -640,   30,
     -18, -549, -119, -715, -233, -640,   30 
};

double **Ab      = ca_A_mR(ab, i_Abr_Ac_bc_mR(RAb, CA, Cb));
double **Ab_free =             i_Abr_Ac_bc_mR(CA,  CA, Cb + FREEV);
double **b_free  =                       i_mR(CA,      Cb + FREEV); 
 
  clrscrn();
  printf(" Ab:");
  p_mR(Ab, S8,P3,C10);
  
  printf(" Ab:  gj_PP_mR(Ab,NO):");
  gj_PP_mR(Ab,NO);
  p_mR(Ab, S8,P3,C10);
  stop();
  
  clrscrn();  
  put_zeroR_mR(Ab,Ab_free);  
  printf(" Ab_free: put_zeroR_mR(Ab,Ab_free);");  
  p_mR(Ab_free, S7,P3,C10);  
  stop();
  
  clrscrn();  
  put_freeV_mR(Ab_free);
  printf(" Ab_free: put_freeV_mR(Ab_free);");  
  p_mR(Ab_free, S7,P3,C10);  
  stop();
  
  clrscrn();  
  printf("\n\n Ab_free: gj_PP_mR(Ab_free,YES);");
  gj_PP_mR(Ab_free,YES); 
  p_mR(Ab_free, S7,P3,C10);  
  stop();	
  
  clrscrn();
  c_Ab_b_mR(Ab_free,b_free);
  printf(" b_free:"); 
  p_mR(b_free, S8,P3,C10);
  printf("          b       FREEV");
  p_freeV(b_free, S8,P3);
  stop();

  f_mR(Ab);
  f_mR(Ab_free);
  f_mR(b_free);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:

 Ab:
 -18.000 -549.000 -119.000 -715.000 -233.000 -640.000  +30.000 
 -18.000 -549.000 -119.000 -715.000 -233.000 -640.000  +30.000 

 Ab:  gj_PP_mR(Ab,NO):
  +1.000  +30.500   +6.611  +39.722  +12.944  +35.556   -1.667 
  +0.000   +0.000   +0.000   +0.000   -0.000   +0.000   +0.000 

 Press return to continue. 


 Ab_free: put_zeroR_mR(Ab,Ab_free);
 +1.000 +30.500  +6.611 +39.722 +12.944 +35.556  -1.667  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 

 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 

 Press return to continue. 


 Ab_free: put_freeV_mR(Ab_free);
 +1.000 +30.500  +6.611 +39.722 +12.944 +35.556  -1.667  +0.000  +0.000  +0.000 
 +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000 
 +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000 
 +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000 
 +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000 

 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +1.000  +0.000 
 +0.000  +1.000 

 Press return to continue. 


 Ab_free: gj_PP_mR(Ab_free,YES);
 +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  -1.667 -30.500  -6.611 -39.722 
 +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000 
 +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000 
 +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000  +1.000 
 +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +1.000  +0.000  +0.000  +0.000  +0.000 

-12.944 -35.556 
 +0.000  +0.000 
 +0.000  +0.000 
 +0.000  +0.000 
 +1.000  +0.000 
 +0.000  +1.000 

 Press return to continue. 


 b_free:
  -1.667  -30.500   -6.611  -39.722  -12.944  -35.556 
  +0.000   +1.000   +0.000   +0.000   +0.000   +0.000 
  +0.000   +0.000   +1.000   +0.000   +0.000   +0.000 
  +0.000   +0.000   +0.000   +1.000   +0.000   +0.000 
  +0.000   +0.000   +0.000   +0.000   +1.000   +0.000 
  +0.000   +0.000   +0.000   +0.000   +0.000   +1.000 

          b       FREEV
 x1 =    -1.667  -30.500*s   -6.611*t  -39.722*u  -12.944*v  -35.556*w
 x2 =    +0.000   +1.000*s   +0.000*t   +0.000*u   +0.000*v   +0.000*w
 x3 =    +0.000   +0.000*s   +1.000*t   +0.000*u   +0.000*v   +0.000*w
 x4 =    +0.000   +0.000*s   +0.000*t   +1.000*u   +0.000*v   +0.000*w
 x5 =    +0.000   +0.000*s   +0.000*t   +0.000*u   +1.000*v   +0.000*w
 x6 =    +0.000   +0.000*s   +0.000*t   +0.000*u   +0.000*v   +1.000*w

 Press return to continue.