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

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 C2 /* ------------------------------------ */ int main(void) { double a[RCA*RCA]={ +0.8,+0.3, +0.2,+0.7 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **Ev = eigs_V_mR(A, i_mR(RCA,RCA)); double **InvEv = invgj_mR(Ev, i_mR(RCA,RCA)); /* Eval = InvEv A Ev */ double **T1 = mul_mR(InvEv, A, i_mR(RCA,RCA)); double **Eval = mul_mR(T1, Ev, i_mR(RCA,RCA)); clrscrn(); printf(" Copy/Paste into the octave windows \n"); p_Octave_mR(A,"a",P9); printf(" [V, E] = eigs (a,%d) \n\n",RCA); printf(" Ev:"); p_mR(Ev,S10,P4,C6); printf(" Eval = InvEv A Ev"); p_mR(Eval,S10,P4,C6); stop(); f_mR(A); f_mR(Ev); f_mR(InvEv); f_mR(Eval); f_mR(T1); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave windows a=[ +0.800000000,+0.300000000; +0.200000000,+0.700000000] [V, E] = eigs (a,2) Ev: +0.8321 +0.7071 +0.5547 -0.7071 Eval = InvEv A Ev +1.0000 +0.0000 -0.0000 +0.5000 Press return to continue.