Linear Algebra and the C Language/a0mo


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RA R4
#define   CA C4

#define   RX R4
#define   CX C1
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double x_B[RX*CX]={
   +1,
   +2, 
   +3, 
   +4 
};

double b[RA*CA]={
    +1, +2, +6, +6,   
    +3, +2, +1, +6,
    +5, +5, +3, +6,
    +5, +5, +2, +4, 
};

double **B   = ca_A_mR(b,     i_mR(RA,CA));

double **x_b = ca_A_mR(x_B,   i_mR(RX,CX));
double **x_s =  mul_mR(B,x_b, i_mR(RX,CX));
 
  clrscrn();
  printf(" B is the base change matrix for base \"B\" \n\n"
         " B :");
  p_mR(B,S8,P2,C7);  
  
  printf(" x_b:           (x_b = InvB x_s) (x in the base \"B\")    ");
  p_mR(x_b,S8,P2,C7);
  
  printf(" x_s:           (x_s = B x_b)     (x in the Standard basis)");
  p_mR(x_s,S8,P2,C7);
  stop();
  
  f_mR(B);  
  
  f_mR(x_b);
  f_mR(x_s); 
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:

                                                                                       
 B is the base change matrix for base "B" 

 B :
   +1.00    +2.00    +6.00    +6.00 
   +3.00    +2.00    +1.00    +6.00 
   +5.00    +5.00    +3.00    +6.00 
   +5.00    +5.00    +2.00    +4.00 

 x_b:           (x_b = InvB x_s) (x in the base "B")
   +1.00 
   +2.00 
   +3.00 
   +4.00 

 x_s:           (x_s = B x_b)     (x in the Standard basis)
  +47.00 
  +34.00 
  +48.00 
  +37.00 

 Press return to continue.