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

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 = rdiag_mR(i_mR(r,r),999.); double **EigsVector= i_mR(r,r); double **EigsValue = 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,EigsVector); printf(" EigsVector:"); p_mR(EigsVector ,S5,P4,C6); eigs_mR(A,EigsValue); printf(" EigsValue:"); p_mR(EigsValue ,S13,P4,C1); f_mR(A); f_mR(EigsVector); f_mR(EigsValue); } /* ------------------------------------ */ 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 diagonal matrix * I check that the eigenvalues ​​of the diagonal 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=[ -582,+0,+0; +0,+695,+0; +0,+0,-405] [V, E] = eigs (a,3) Press return to continue. A: -582 +0 +0 +0 +695 +0 +0 +0 -405 EigsVector: +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 EigsValue: -582.0000 +695.0000 -405.0000 Press return to continue Press X return to stop