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

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: c00d.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ void X_gj3_T_mR( double **Ab, int above ) { int r= R1; int c= C1; while( (r<Ab[R_SIZE][C0]) && (c<Ab[C_SIZE_A][C0]) ) { if(pivotbest_gj3Ab_mR(Ab,r,c)>ERROR_E) zero_under_pivot_gj3Ab_mR(Ab,r,c); else r--; r++; c++; } r = Ab[R_SIZE][C0]; if(above) while(r>R2) { r--; c=C1; while(fabs(Ab[r][c])<ERROR_E && c<(Ab[C_SIZE_A][C0]-C1) ) c++; if(fabs(Ab[r][c])>ERROR_E) { printf(" Ab: pivot[%d][[%d] ",r,c); p_mR(Ab,S8,P4,C8); zero_above_pivot_gj3Ab_mR(Ab,r,c); printf(" Ab: pivot[%d][[%d]" " zero_above_pivot_gj1Ab_mR();",r,c); p_mR(Ab,S8,P4,C8); stop(); clrscrn(); } } } /* ------------------------------------ */ double **X_gj_PP_mR( double **Ab, int above ) { X_gj3_T_mR(Ab,above); return(Ab); } /* ------------------------------------ */ /* ------------------------------------ */ void fun(int r) { double **A = r_mR( i_mR(r,r),999.); double **b = r_mR( i_mR(r,C1),999.); double **Ab = c_A_b_Ab_mR(A,b, i_Abr_Ac_bc_mR( r, r, C1));; /* i_Abr_Ac_bc_mR(RAb, CA, Cb)); */ clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(Ab,"Ab",P0); printf("\n rref(Ab,.00000000001)\n\n"); stop(); clrscrn(); X_gj_PP_mR(Ab,YES); printf(" gj_PP_mR(Ab,YES);"); p_mR(Ab,S10,P4,C7); f_mR(Ab); f_mR(b); f_mR(A); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(R6); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave window. Ab=[ -334,+54,+409,+688,+310; -313,+959,+202,-367,+710; +335,+854,+794,-971,+114; -73,+946,-507,-468,-818] rref(Ab,.00000000001) Press return to continue. Ab: pivot[4][[4] +1.0000 +2.5493 +2.3701 -2.8985 +0.3403 +0.0000 +1.0000 +0.5372 -0.7253 +0.4647 -0.0000 -0.0000 +1.0000 -0.1502 +1.4003 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Ab: pivot[4][[4] zero_above_pivot_gj1Ab_mR(); +1.0000 +2.5493 +2.3701 +0.0000 -5.6337 +0.0000 +1.0000 +0.5372 +0.0000 -1.0301 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Press return to continue. Ab: pivot[3][[3] +1.0000 +2.5493 +2.3701 +0.0000 -5.6337 +0.0000 +1.0000 +0.5372 +0.0000 -1.0301 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Ab: pivot[3][[3] zero_above_pivot_gj1Ab_mR(); +1.0000 +2.5493 +0.0000 +0.0000 -8.2190 +0.0000 +1.0000 +0.0000 +0.0000 -1.6161 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Press return to continue. Ab: pivot[2][[2] +1.0000 +2.5493 +0.0000 +0.0000 -8.2190 +0.0000 +1.0000 +0.0000 +0.0000 -1.6161 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Ab: pivot[2][[2] zero_above_pivot_gj1Ab_mR(); +1.0000 -0.0000 +0.0000 +0.0000 -4.0992 +0.0000 +1.0000 +0.0000 +0.0000 -1.6161 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Press return to continue. gj_PP_mR(Ab,YES); +1.0000 -0.0000 +0.0000 +0.0000 -4.0992 +0.0000 +1.0000 +0.0000 +0.0000 -1.6161 +0.0000 -0.0000 +1.0000 +0.0000 +1.0908 +0.0000 +0.0000 +0.0000 +1.0000 -2.0610 Press return to continue Press X return to stop