Linear Algebra and the C Language/a080


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as:   c00b.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R4
#define   CA C6
#define   Cb C1
/* ------------------------------------ */
int main(void)
{
double ab[RA*(CA+Cb)]={
    +1,     -3,     +4,     -2,    +5,    +4,  0,
    +2,     -6,     +9,     -1,    +8,    +2,  0,
    +2,     -6,     +9,     -1,    +9,    +7,  0, 
    -1,      3,     -4,      2,    -5,    -4,  0,  
};

double **Ab =   ca_A_mR(ab, i_Abr_Ac_bc_mR(RA,CA,Cb));

  clrscrn();
  printf(" Copy/Paste into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf("\n rref(Ab,.00000000001)\n\n");
  
  printf("  gj_PP_mR(Ab,YES):");
  p_mR(gj_PP_mR(Ab,YES), S10,P2,C7);
  
/* Error:
  printf("  gj_TP_mR(Ab):");
  p_mR(gj_TP_mR(Ab), S10,P2,C7); 
*/
  stop();

  f_mR(Ab);

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:

 Copy/Paste into the octave window.

 Ab=[
+1,-3,+4,-2,+5,+4,+0;
+2,-6,+9,-1,+8,+2,+0;
+2,-6,+9,-1,+9,+7,+0;
-1,+3,-4,+2,-5,-4,+0]


 rref(Ab,.00000000001)

  gj_PP_mR(Ab,YES):
     +1.00      -3.00      +0.00     -14.00      +0.00     -37.00      +0.00 
     +0.00      +0.00      +1.00      +3.00      +0.00      +4.00      +0.00 
     +0.00      +0.00      +0.00      +0.00      +1.00      +5.00      +0.00 
     +0.00      +0.00      +0.00      +0.00      +0.00      +0.00      +0.00 

 Press return to continue.