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

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" /* ------------------------------------ */ /* ------------------------------------ */ double **X_sort_r_mR( double **Ab ) { double pivot; int c; int r; int r_pivot = R1; clrscrn(); printf(" Ab : Before the function sort_r_mR(); \n"); p_mR(Ab, S8,P4,C6); stop(); clrscrn(); for ( c=C1; c<Ab[C_SIZE_A][C0]; c++) { r = r_pivot; pivot = 0.; while( (pivot<ERROR_E) && r<Ab[R_SIZE][C0] ) { pivot = fabs( Ab[r][c] ); clrscrn(); printf("/* --------- DEBUG 1 ---------- */\n\n"); printf(" Ab : pivot[%d][%d] = %f \n",r,c,pivot); p_mR(Ab, S8,P4,C8); if(pivot>ERROR_E) { swapR_mR(Ab, r, r_pivot); r_pivot++; } printf(" Ab"); p_mR(Ab, S8,P4,C8); stop(); clrscrn(); /* --------- DEBUG 1 ---------- */ r++; } } return(Ab); } /* ------------------------------------ */ /* ------------------------------------ */ double **X_gj_TP_mR( double **Ab ) { gj1_T_mR(Ab); sort_c_mR(Ab); X_sort_r_mR(Ab); 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(); X_gj_TP_mR(Ab); printf("Ab : After the function: sort_r_mR();\n\n" " gj_TP_mR(Ab);"); 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(R5); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Ab : Before the function sort_r_mR(); +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Press return to continue. /* --------- DEBUG 1 ---------- */ Ab : pivot[1][1] = 0.000000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Ab +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Press return to continue. /* --------- DEBUG 1 ---------- */ Ab : pivot[2][1] = 0.000000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Ab +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Press return to continue. /* --------- DEBUG 1 ---------- */ Ab : pivot[3][1] = 0.000000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Ab +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Press return to continue. /* --------- DEBUG 1 ---------- */ Ab : pivot[4][1] = 0.000000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Ab +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Press return to continue. /* --------- DEBUG 1 ---------- */ Ab : pivot[5][1] = 1.000000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 Ab +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 Press return to continue. .... .... .... Ab : After the function: sort_r_mR(); gj_TP_mR(Ab); +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -10.7817 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +4.5128 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +4.8739 +0.0000 -0.0000 -0.0000 +1.0000 -0.0000 -0.5550 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 -1.5244 Press return to continue Press X return to stop