Linear Algebra and the C Language/a0dl


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A  = rcentrosymmetric_mR(     i_mR(r,r),9.);
double **J  =                J_mR(     i_mR(r,r));
double **JA =              mul_mR(J,A, i_mR(r,r));
double **AJ =              mul_mR(A,J, i_mR(r,r));

  clrscrn();
  printf(" A:");
  p_mR(A, S5,P0,C7);   
  printf(" J:");
  p_mR(J, S5,P0,C7); 
  stop();  

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

  srand(time(&t));

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

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
A matrix A is centrosymmetric if and only if AJ = JA.

Screen output example:

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

 J:
   +0    +0    +1 
   +0    +1    +0 
   +1    +0    +0 

 Press return to continue. 


 AJ:
   +8    -6    -1 
   -5    +4    -5 
   -1    -6    +8 

 JA:
   +8    -6    -1 
   -5    +4    -5 
   -1    -6    +8 


 Press   return to continue
 Press X return to stop