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

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 : c00c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC4 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double a[RCA*RCA] ={ +3.267287828, -0.475271661, -0.227635307, +0.991405738, -0.475271661, +3.181920907, -1.871467453, -1.222576216, -0.227635307, -1.871467453, +2.581540251, -0.755834393, +0.991405738, -1.222576216, -0.755834393, +1.969251014 }; 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, S9,P5, C4); 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), S9,P4, C4); stop(); clrscrn(); printf(" A :"); p_mR(A, S9,P5, C4); printf(" A = V * EValue * invV"); mul_mR(V,EValue,T); mul_mR(T,invV,A); p_mR(A, S9,P5, C4); 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 : +3.26729 -0.47527 -0.22764 +0.99141 -0.47527 +3.18192 -1.87147 -1.22258 -0.22764 -1.87147 +2.58154 -0.75583 +0.99141 -1.22258 -0.75583 +1.96925 V : -0.31795 +0.69685 +0.64009 -0.05995 +0.76747 +0.13627 +0.28512 +0.55779 -0.47145 -0.53535 +0.40238 +0.57378 -0.29602 +0.45742 -0.58914 +0.59670 EValue = invV * A * V +5.0000 +0.0000 +0.0000 +0.0000 +0.0000 +4.0000 +0.0000 +0.0000 +0.0000 +0.0000 +2.0000 +0.0000 +0.0000 +0.0000 +0.0000 -0.0000 Press return to continue. A : +3.26729 -0.47527 -0.22764 +0.99141 -0.47527 +3.18192 -1.87147 -1.22258 -0.22764 -1.87147 +2.58154 -0.75583 +0.99141 -1.22258 -0.75583 +1.96925 A = V * EValue * invV +3.26729 -0.47527 -0.22764 +0.99141 -0.47527 +3.18192 -1.87147 -1.22258 -0.22764 -1.87147 +2.58154 -0.75583 +0.99141 -1.22258 -0.75583 +1.96925 Press return to continue.