Linear Algebra and the C Language/a001


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A        =       r_mR(   i_mR(r,r),9.);
double **Aadjoint = adjoint_mR(A, i_mR(r,r)   );

  clrscrn();
  printf(" A :");
  p_mR(A,S3,P0,C6);
  
  printf(" adjoint(A) :");
  p_mR(Aadjoint,S6,P0,C6);

  f_mR(A);
  f_mR(Aadjoint);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC4)+C1);

} while(stop_w());

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


Screen output example:

 A :
 +2  +4  -2  +3 
 +2  +7  -5  +6 
 +8  +5  +2  +4 
 +2  -3  +3  -2 

 adjoint(A) :
   +24     -3     -6    +15 
   +32    -20     -0    -12 
   -32     +2    +12    -18 
   -72    +30    +12     -6 


 Press   return to continue
 Press X return to stop