Linear Algebra and the C Language/a0k6


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include      "v_a.h"
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
double ta[R3*C4]={ 1,0,0, 1,
                   0,1,0, 2,
                   0,0,1, 3};
                   
double **T  =  ca_A_mR(ta,                i_mR(R3,C4));
double **A  =     r_mR(                   i_mR(R3,C3),999.);  
double **AT =   mul_mR(A,T,               i_mR(R3,C4));  
double **Ab = gj_TP_mR(c_mR(AT, i_Abr_Ac_bc_mR(R3,C3,C1)));     

  clrscrn();
  printf(" Find a matrice, that has this reduced row-echelon form :\n"
         " Ab:");
  p_mR(T, S5,P0,C6);
  
  printf(" With, A = r_mR(i_mR(R3,C3),999.)");
  p_mR(A, S5,P0,C6);  
  
  printf(" And, T:");
  p_mR(T, S5,P0,C6); 

  printf(" I suggest this matrix: AT = Ab\n"  
  " Ab:");
  p_mR(AT, S5,P0,C6);
  stop();  

  clrscrn();  
  printf(" gj_TP_mR(Ab); ");
  p_mR(Ab, S10,P5,C7);
  stop();


  f_mR(Ab);
  f_mR(A);
  f_mR(T);
  f_mR(AT);

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

Screen output example:

                                                                                       
 Find a matrice, that has this reduced row-echelon form :
 Ab:
   +1    +0    +0    +1 
   +0    +1    +0    +2 
   +0    +0    +1    +3 

 With, A = r_mR(i_mR(R3,C3),999.)
 -527  +647  -840 
 +394  -818  +992 
 +849  +393  +759 

 And, T:
   +1    +0    +0    +1 
   +0    +1    +0    +2 
   +0    +0    +1    +3 

 I suggest this matrix: AT = Ab
 Ab:
 -527  +647  -840 -1753 
 +394  -818  +992 +1734 
 +849  +393  +759 +3912 

 Press return to continue. 


 gj_TP_mR(Ab); 
  +1.00000   -0.00000   -0.00000   +1.00000 
  +0.00000   +1.00000   +0.00000   +2.00000 
  +0.00000   +0.00000   +1.00000   +3.00000 

 Press return to continue.