Linear Algebra and the C Language/a0pa


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */     
#define RCA          RC4  
/* ------------------------------------ */       
/* ------------------------------------ */
int main(void)
{                          
double NVN[RCA*RCA] ={   
+0.730296743340, -0.258198889747, -0.272165526976, -0.447213595500, 
+0.547722557505, -0.258198889747, -0.680413817440, -0.596284794000, 
-0.182574185835, +0.516397779494, +0.544331053952, +0.298142397000, 
-0.365148371670, -0.774596669241, -0.408248290464, -0.596284794000     
};
 
double E[RCA*RCA] ={   
+1, 0, +0, +0, 
+0, 1, +0, +0, 
+0, 0, +1, +0, 
+0, 0, +0, +0    
};
                       
double **Nvn    =  ca_A_mR(NVN,        i_mR(RCA,RCA));
double **invNvn = invgj_mR(Nvn,        i_mR(RCA,RCA));

double **EValue =  ca_A_mR(E,          i_mR(RCA,RCA));

double **T      =   mul_mR(Nvn,EValue, i_mR(RCA,RCA));
double **A      =   mul_mR(T,  invNvn, i_mR(RCA,RCA));

  clrscrn(); 
  printf(" Nv1,Nv2,Nv3: The normalized hyperplan vectors\n" 
         "         Nv4: The normalized projector vector\n\n");
  
  printf(" Nvn:  v1        v2        v3        v4");
  p_mR(Nvn, S8,P6, C4);     

  printf(" EValue1   EValue2   EValue3   EValue4");
  p_mR(EValue, S9,P6, C4); 
 
  printf(" Copy this code into the files c00c.c and c00d.c\n\n"
         " A = Nvn EValue invNvn");
  P_mR(A, S8,P12, C4);
  stop();
  
  f_mR(A);
  f_mR(Nvn);
  f_mR(invNvn);
  f_mR(EValue);
  f_mR(T);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
 You calculate the matrix A that projects the hyperspace in the direction of the  eigenvector (Nv4)  on a hyperplan  determined by the eigenvectors (Nv1, Nv2, Nv3). Next you must copy this matrix into the files c00c.c and c00d.c

Screen output example:

                                                                                       
 Nv1,Nv2,Nv3: The normalized hyperplan vectors
         Nv4: The normalized projector vector

 Nvn:  v1        v2        v3        v4
+0.730297 -0.258199 -0.272166 -0.447214 
+0.547723 -0.258199 -0.680414 -0.596285 
-0.182574 +0.516398 +0.544331 +0.298142 
-0.365148 -0.774597 -0.408248 -0.596285 

 EValue1   EValue2   EValue3   EValue4
+1.000000 +0.000000 +0.000000 +0.000000 
+0.000000 +1.000000 +0.000000 +0.000000 
+0.000000 +0.000000 +1.000000 +0.000000 
+0.000000 +0.000000 +0.000000 +0.000000 

 Copy this code into the files c00c.c and c00d.c

 A = Nvn EValue invNvn
+0.812500000000, -0.656250000000, -1.406250000000, -0.656250000000, 
-0.250000000000, +0.125000000000, -1.875000000000, -0.875000000000, 
+0.125000000000, +0.437500000000, +1.937500000000, +0.437500000000, 
-0.250000000000, -0.875000000000, -1.875000000000, +0.125000000000  

 Press return to continue.