Linear Algebra and the C Language/a0i5


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00f.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A   = rskewsymmetric_mR(i_mR(rc,rc),9);
double **A_2 =                   i_mR(rc,rc);

  clrscrn();

  printf(" A is a skew symmetric matrix");
  p_mR(A, S4,P0,C6);

  printf(" A**2 is a symmetric negative semi-definite matrix");
  p_mR(mul_mR(A,A,A_2), S4,P0,C6);
  
  f_mR(A);
  f_mR(A_2);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC4)+RC1);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
A**2 is a negative semidefinite symmetric matrix

Screen output example:

                                                                                       
 A is a skew symmetric matrix
  +0   -5   -1   +5   +7 
  +5   +0   +5   -8   +1 
  +1   -5   +0   +1   +2 
  -5   +8   -1   +0   +5 
  -7   -1   -2   -5   +0 

 A**2 is a symmetric negative semi-definite matrix
-100  +38  -44   +4  +18 
 +38 -115   +1  +25   +5 
 -44   +1  -31  +35   +7 
  +4  +25  +35 -115  -29 
 +18   +5   +7  -29  -79 


 Press   return to continue
 Press X return to stop