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

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 = rsymmetric_mR( i_mR(RCA,RCA),9.); double **EVector = eigs_V_mR(A, i_mR(RCA,RCA)); double **EVectorT = transpose_mR(EVector, i_mR(RCA,RCA)); double **T = mul_mR(EVectorT,A, i_mR(RCA,RCA)); double **EValue = mul_mR(T,EVector, i_mR(RCA,RCA)); clrscrn(); printf(" Copy/Paste into the octave windows \n\n"); p_Octave_mR(A,"a",P0); printf(" [V, E] = eigs (a,%d) \n\n",RCA); printf(" EVector:"); p_mR(EVector,S10,P4,C6); printf(" EValue = EVectorT A EVector"); p_mR(EValue,S10,P4,C6); f_mR(A); 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 windows a=[ +9,+6,-1; +6,+5,+5; -1,+5,+4] [V, E] = eigs (a,3) EVector: +0.7319 -0.5446 -0.4095 +0.6349 +0.3267 +0.7002 +0.2476 +0.7724 -0.5849 EValue = EVectorT A EVector +13.8665 +0.0000 -0.0000 +0.0000 +6.8196 -0.0000 -0.0000 +0.0000 -2.6860 Press return to continue Press X return to stop