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

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 : c00b.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ double **X_sort_c_mR( double **Ab ) { double **T = i_RC_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]); int c; for(c=C1; c<Ab[C_SIZE][C0]; c++) c_c_withR0_mR(Ab, c, /* Copy the columns of Ab into */ T, Ab[R0][c]); /* T in the good order */ c_withR0_mR(T,Ab); /* Copy T into Ab */ f_mR(T); return(Ab); } /* ------------------------------------ */ /* ------------------------------------ */ double **X_gj_TP_mR( double **Ab ) { gj1_T_mR(Ab); X_sort_c_mR(Ab); /* Sort the columns */ /* 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(); 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_TP_mR(Ab); printf(" See above for the function code: sort_c_mR(Ab);\n\n" " The rows are not sorted:\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(rp_I(R2)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave window. Ab=[ +191,+867,-846,-252,-991; -266,-566,+965,+145,-77; -305,-132,-701,+743,-321; +356,+64,+93,-371,+711] rref(Ab,.00000000001) Press return to continue. See above for the function code: sort_c_mR(Ab); The rows are not sorted: gj_TP_mR(Ab); +0.0000 -0.0000 +1.0000 +0.0000 -1.6818 +0.0000 -0.0000 +0.0000 +1.0000 -2.4359 +0.0000 +1.0000 +0.0000 +0.0000 -3.6127 +1.0000 -0.0000 +0.0000 +0.0000 +0.5475 Press return to continue Press X return to stop