Linear Algebra and the C Language/a0h6


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U   = r_mR(          i_mR(R1, r),9);
double **V   = r_mR(          i_mR(r ,C1),9);	
double **A   = rHankel_mR(U,V,i_mR(r , r)  );
double **Inv =                i_mR(r,  r);

  clrscrn();
  printf(" Copy/Paste into the octave window.\n\n");
  p_Octave_mR(A,"A",P0);
  printf(" inv(A)\n\n");
  printf(" The  inverse  remains  symmetric,\n"
         " but is no longer a Hankel matrix.\n\n"
         " inv(A):");
  p_mR(inv_mR(A,Inv), S5,P6,C7);;

  f_mR(U);
  f_mR(V);   
  f_mR(A);

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

  srand(time(&t));
do
{
  fun(RC5);

} while(stop_w());


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


Screen output example:

                                                                                       
 Copy/Paste into the octave window.

 A=[
+9,-1,-9,+3,-8;
-1,-9,+3,-8,-5;
-9,+3,-8,-5,-8;
+3,-8,-5,-8,-6;
-8,-5,-8,-6,+4]

 inv(A)

 The  inverse  remains  symmetric,
 but is no longer a Hankel matrix.

 inv(A):
-0.051757 -0.124969 -0.033446 +0.174789 -0.064434 
-0.124969 -0.193089 +0.051178 +0.191033 -0.102392 
-0.033446 +0.051178 -0.004265 -0.024691 -0.048485 
+0.174789 +0.191033 -0.024691 -0.300845 +0.087719 
-0.064434 -0.102392 -0.048485 +0.087719 +0.027751 


 Press   return to continue
 Press X return to stop