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

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

__NOTOC__ Code study: eigs_mR(); I want to calculate the eigenvalues ​​of the matrix M. I use the QR decomposition of M. Then I calculate RQ. RQ becomes the new value of M. And I start a cycle again. To avoid modifying M, I copy it into T. Then I apply the algorithm seen above 1000 times. c_mR(M,T); for(i=0;i<1000;i++) { QR_mR(T,Q,R); mul_mR(R,Q,T); } Finally, I find the eigenvalues ​​on the diagonal of T. for(rc=R1;rc<=r;rc++) { EValue[rc][C1] = T[rc][rc]; } /* ------------------------------------ */ /* ------------------------------------ */ double **eigs_mR( double **A, double **EValue ) { int r = rsize_R(A); double **T = i_mR(r,r); double **Q = i_mR(r,r); double ** = i_mR(r,r); int i; int rc; c_mR(A,T); for(i=0;i<LOOP_EIGSUV;i++) { QR_mR(T,Q,R); mul_mR(R,Q,T); } for(rc=R1;rc<=r;rc++) { EValue[rc][C1] = T[rc][rc]; } f_mR(T); f_mR(Q); f_mR(R); return(EValue); } /* ------------------------------------ */ /* ------------------------------------ */