411 REFERENCE · Wikibooks
Linear Algebra and the C Language/a0oz
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC2
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double NLV[RCA*RCA] ={
+0.970142500145, -0.447213595500,
-0.242535625036, +0.894427191000
};
double E[RCA*RCA] ={
+1, 0,
+0, 0
};
double **Nlv = ca_A_mR(NLV, i_mR(RCA,RCA));
double **invNlv = invgj_mR(Nlv, i_mR(RCA,RCA));
double **EValue = ca_A_mR(E, i_mR(RCA,RCA));
double **T = mul_mR(Nlv,EValue, i_mR(RCA,RCA));
double **A = mul_mR(T, invNlv, i_mR(RCA,RCA));
clrscrn();
printf(" Nl: The normalized line vector\n"
" Nv: The normalized projector vector\n\n");
printf(" Nl Nv:");
p_mR(Nlv, S8,P6, C3);
printf(" EValue:");
p_mR(EValue, S9,P12, C4);
printf(" Copy this matrix into the files c00c.c and c00d.c\n\n"
" A = Nlv EValue invNlv");
P_mR(A, S8,P12, C3);
stop();
f_mR(A);
f_mR(Nlv);
f_mR(invNlv);
f_mR(T);
f_mR(EValue);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
You calculate the matrix A that projects the plane in the direction of the eigenvector (Nv) on a line determined by the eigenvector (Nl). Next you must copy this matrix into the files c00c.c and c00d.c
Screen output example:
Nl: The normalized line vector
Nv: The normalized projector vector
Nl Nv:
+0.970143 -0.447214
-0.242536 +0.894427
EValue:
+1.000000000000 +0.000000000000
+0.000000000000 +0.000000000000
Copy this matrix into the files c00c.c and c00d.c
A = Nlv EValue invNlv
+1.142857142857, +0.571428571428,
-0.285714285714, -0.142857142857
Press return to continue.