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

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

__NOTOC__ Install this file in your working directory. /* ------------------------------------ */ /* Save as : vgj1piv.h */ /* ------------------------------------ */ double pivotbest_gj1Ab_mR( double **Ab, int pv ) { double pvbest = fabs(Ab[pv][pv]); int best_r = pv; int best_c = pv; int r; int c; for ( r=pv; r<Ab[R_SIZE][C0]; r++) for ( c=pv; c<Ab[R_SIZE][C0]; c++) if(fabs(Ab[r][c])>pvbest) { pvbest = fabs(Ab[r][c]); best_r = r; best_c = c; } if(best_r!=pv) swapR_mR(Ab,pv,best_r); if(best_c!=pv) swapC_withR0_mR(Ab,pv,best_c); return(pvbest); } /* ------------------------------------ */ double **zero_under_pivot_gj1Ab_mR( double **Ab, int pv ) { double pivot = Ab[pv][pv]; int r; if(fabs(pivot)>ERROR_E) { mulR_mR( Ab,(1./pivot),pv); for( r=(pv+C1); r<Ab[R_SIZE][C0]; r++) addR_mR( Ab,(-Ab[r][pv]),pv,r); } return(Ab); } /* ------------------------------------ */ double **zero_above_pivot_gj1Ab_mR( double **Ab, int pv ) { int r; if(fabs(Ab[pv][pv])>ERROR_E) for( r=(pv-R1); r>=R1; r--) addR_mR( Ab,(-Ab[r][pv]),pv,r); return(Ab); } /* ------------------------------------ */ /* ------------------------------------ */