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

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 : c00e.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double **A = rlower_mR( i_mR(r,r),999.); double **EVector = i_mR(r,r); double **EValue = i_mR(r,C1); clrscrn(); printf(" Copy/Paste into the octave windows \n\n"); p_Octave_mR(A,"a",P0); printf(" [V, E] = eigs (a,%d) \n\n",r); stop(); clrscrn(); printf(" A:"); p_mR(A ,S5,P0,C6); eigs_V_mR(A,EVector); printf(" EVector:"); p_mR(EVector ,S5,P4,C6); eigs_mR(A,EValue); printf(" EValue:"); p_mR(EValue ,S13,P4,C1); f_mR(A); f_mR(EVector); f_mR(EValue); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R3)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ * Eigenvalues and ​​eigenvectors of a lower triangular matrix * I check that the eigenvalues ​​of the lower triangular matrix A correspond to the values ​​found on the diagonal. They can be in a different order. Screen output example: Copy/Paste into the octave windows a=[ -330,+0,+0,+0,+0; +864,-659,+0,+0,+0; -95,+905,-764,+0,+0; -531,-951,-303,-279,+0; +146,+78,-299,-845,+269] [V, E] = eigs (a,5) Press return to continue. A: -330 +0 +0 +0 +0 +864 -659 +0 +0 +0 -95 +905 -764 +0 +0 -531 -951 -303 -279 +0 +146 +78 -299 -845 +269 EVector: +0.0000 -0.0000 +0.0063 +0.0000 +0.0000 -0.0000 +0.0588 +0.0166 +0.0000 +0.0000 +0.7017 +0.5068 +0.0332 +0.0000 +0.0000 +0.4384 +0.5512 +0.5718 +0.5441 -0.0000 +0.5617 +0.6602 +0.8195 +0.8390 +1.0000 EValue: -764.0000 -659.0000 -330.0000 -279.0000 +269.0000 Press return to continue Press X return to stop