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

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 : c00a.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC3 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double a[RCA*RCA] ={ +1.345288030, +1.760536858, -1.232763852, +1.760536858, +4.139646496, +0.479295438, -1.232763852, +0.479295438, +3.515065475 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **V = eigs_V_mR(A, i_mR(RCA,RCA)); double **invV = invgj_mR(V, i_mR(RCA,RCA)); double **EValue = eigs_mR(A, i_mR(RCA, RCA)); double **T = i_mR(RCA,RCA); clrscrn(); printf(" A :"); p_mR(A, S8,P5, C3); printf(" V :"); p_mR(V, S9,P5, C4); printf(" EValue = invV * A * V"); mul_mR(invV,A,T); mul_mR(T,V,EValue); p_mR(clean_eye_mR(EValue), S12,P4, C3); printf(" A = V * EValue * invV"); mul_mR(V,EValue,T); mul_mR(T,invV,A); p_mR(A, S8,P5, C3); stop(); f_mR(A); f_mR(V); f_mR(invV); f_mR(T); f_mR(EValue); } /* ------------------------------------ */ int main(void) { fun(); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : +1.34529 +1.76054 -1.23276 +1.76054 +4.13965 +0.47930 -1.23276 +0.47930 +3.51507 V : +0.45779 -0.27269 +0.84621 +0.88400 +0.24101 -0.40057 -0.09471 +0.93143 +0.35139 EValue = invV * A * V +5.0000 +0.0000 +0.0000 +0.0000 +4.0000 +0.0000 +0.0000 +0.0000 +0.0000 A = V * EValue * invV +1.34529 +1.76054 -1.23276 +1.76054 +4.13965 +0.47930 -1.23276 +0.47930 +3.51507 Press return to continue.