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

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 : bestp.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double **A = r_mR(i_mR(r,r),99.); clrscrn(); printf(" A :"); p_mR(A,S5,P0,C6); printf(" The coefficient with the largest absolute \n" " value is chosen as the pivot (A[R1,C1]). \n" " The rows and columns are swapped to get this pivot.\n\n"); pivotbest_mR(A,RC1); printf(" A :"); p_mR(A,S5,P0,C6); f_mR(A); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R3)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Select the best pivot: Screen output example: A : +53 +79 -5 +74 -44 -74 +92 -17 +11 +60 +72 +2 -62 -74 +49 +78 -41 -99 +2 -85 +62 -15 +3 +69 -93 The coefficient with the largest absolute value is chosen as the pivot (A[R1,C1]). The rows and columns are swapped to get this pivot. A : -99 -41 +78 +2 -85 -17 +92 -74 +11 +60 -62 +2 +72 -74 +49 -5 +79 +53 +74 -44 +3 -15 +62 +69 -93 Press return to continue Press X return to stop