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/a0cg

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 RC4 /* ------------------------------------ */ void fun(void) { double **A = rEsymmetric_mR(i_mR(RCA,RCA),999,+1.E-3); double **LogA_EValue = i_mR(RCA,RCA); double **LogA = i_mR(RCA,RCA); double **Exp_LogA_EValue = i_mR(RCA,RCA); double **Exp_LogA = i_mR(RCA,RCA); double **EVector = i_mR(RCA,RCA); double **EVectorT = i_mR(RCA,RCA); double **EValue = 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", P4); 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, LogA_EValue); /* LogA = EVector LogA_EValue EVectorT */ mul_mR(EVector,LogA_EValue,T); mul_mR(T,EVectorT,LogA); p_mR(LogA, S9,P4, C6); stop(); /* ================================================================== */ clrscrn(); eigs_V_mR(LogA,EVector); transpose_mR(EVector,EVectorT); /* LogA_EValue = EVectorT LogA EVector */ mul_mR(EVectorT,LogA,T); mul_mR(T,EVector,LogA_EValue); printf(" Exp_LogA = A"); f_eigs_mR(exp,LogA_EValue, Exp_LogA_EValue); /* A = EVector Exp_LogA_EValue EVectorT */ mul_mR(EVector,Exp_LogA_EValue,T); mul_mR(T,EVectorT,Exp_LogA); p_mR(Exp_LogA, S9,P4, C6); printf(" A:"); p_mR(A, S9,P4, C6); f_mR(A); f_mR(LogA_EValue); f_mR(LogA); f_mR(EVector); f_mR(EVectorT); f_mR(EValue); 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=[ +0.9278,+0.0302,-0.1843,+0.3124; +0.0302,+0.8712,+0.4961,+0.4018; -0.1843,+0.4961,+0.9266,+0.5917; +0.3124,+0.4018,+0.5917,+0.7404] logm (A) LogA -0.3164 +0.0339 -0.5592 +0.7361 +0.0339 -0.3705 +0.5283 +0.3694 -0.5592 +0.5283 -0.7673 +1.1333 +0.7361 +0.3694 +1.1333 -1.1409 Press return to continue. Exp_LogA = A +0.9278 +0.0302 -0.1843 +0.3124 +0.0302 +0.8712 +0.4961 +0.4018 -0.1843 +0.4961 +0.9266 +0.5917 +0.3124 +0.4018 +0.5917 +0.7404 A : +0.9278 +0.0302 -0.1843 +0.3124 +0.0302 +0.8712 +0.4961 +0.4018 -0.1843 +0.4961 +0.9266 +0.5917 +0.3124 +0.4018 +0.5917 +0.7404 Press return to continue Press X return to stop