Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Linear Algebra and the C Language/a0cd

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 RC5 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double **A = rEsymmetric_mR( i_mR(RCA,RCA),999,+1.E-3); double **EValue = i_mR(RCA,RCA); double **Log_EValue = i_mR(RCA,RCA); double **LogA = i_mR(RCA,RCA); double **EVector = i_mR(RCA,RCA); double **EVectorT = i_mR(RCA,RCA); double **T = i_mR(RCA,RCA); clrscrn(); printf(" Copy/Paste into the octave window. \n\n"); p_Octave_mR(A,"A", P6); printf(" logm (A)\n\n\n"); eigs_V_mR(A,EVector); transpose_mR(EVector,EVectorT); /* EValue = EVectorT A EVector */ mul_mR(EVectorT,A,T); mul_mR(T,EVector,EValue); printf(" LogA:"); f_eigs_mR(log,EValue, Log_EValue); /* LogA = EVector Log_EValue EVectorT */ mul_mR(EVector,Log_EValue,T); mul_mR(T,EVectorT,LogA); p_mR(LogA, S9,P6, C6); f_mR(A); f_mR(EValue); f_mR(Log_EValue); f_mR(LogA); f_mR(EVector); f_mR(EVectorT); f_mR(T); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave window. A=[ +1.357734,-0.123337,-1.397583,-0.523404,+0.296125; -0.123337,+0.350535,-0.197543,+0.337885,-0.144267; -1.397583,-0.197543,+1.888885,+0.122765,+0.094678; -0.523404,+0.337885,+0.122765,+0.642718,-0.602939; +0.296125,-0.144267,+0.094678,-0.602939,+1.464218] logm (A) LogA : -1.886935 -0.574739 -2.281263 -1.354664 +0.208755 -0.574739 -1.888205 -0.716984 +0.981584 +0.179825 -2.281263 -0.716984 -0.692397 -0.524562 +0.208617 -1.354664 +0.981584 -0.524562 -1.870239 -0.793007 +0.208755 +0.179825 +0.208617 -0.793007 +0.154821 Press return to continue Press X return to stop