Linear Algebra and the C Language/a0gu


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :  c00b.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A  = rcentrosymmetric_mR(     i_mR(r,r),9.);
double **B  = rcentrosymmetric_mR(     i_mR(r,r),9.);
double **AB =              mul_mR(A,B, i_mR(r,r));

  clrscrn();
  printf(" A:");
  p_mR(A, S5,P0,C7);   
  printf(" B:");
  p_mR(B, S5,P0,C7);   
  
  printf(" AB:");
  p_mR(AB, S5,P0,C7);      
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun( rp_I(RC2)*RC2 + RC1);

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
The product of the matrix AB is centrosymmetric

Screen output example:

                                                                                       
 A:
   +6    +9    -4 
   -5    +1    -5 
   -4    +9    +6 

 B:
   -4    +2    -7 
   -6    -7    -6 
   -7    +2    -4 

 AB:
  -50   -59   -80 
  +49   -27   +49 
  -80   -59   -50 


 Press   return to continue
 Press X return to stop