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

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: c00c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ # define RAb C4 # define CA C6 # define Cb C1 /* ------------------------------------ */ # define FREEV C3 /* ------------------------------------ */ /* ------------------------------------ */ void X_put_freeV_mR( double **Ab_free ) { int r; int t=1; for (r=R1; r<Ab_free[R_SIZE][C0]; r++) if(Ab_free[r][r]< ERROR_E) /* If the pivot is zero */ { /* introduce a free variable */ c_s_mR(1.,Ab_free,r,r); /* Copy 1 into the free row */ c_s_mR(1.,Ab_free,r,rsize_R(Ab_free)+C1+t); t++; /* Copy 1 into the free column */ } } /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double ab[R4*C7]={ +1.0, -3.0, +4.5, -0.5, +4.0, +1.0, +0.0, -0.0, -0.0, +1.0, +3.0, -2.0, -6.0, -0.0, +0.0, +0.0, +0.0, +0.0, +1.0, +5.0, +0.0, +0.0, +0.0, +0.0, +0.0, +0.0, +0.0, +0.0 }; double **Ab = ca_A_mR(ab, i_Abr_Ac_bc_mR(RAb, CA, Cb)); double **Ab_free = i_Abr_Ac_bc_mR(CA, CA, Cb + FREEV); clrscrn(); printf(" Ab: b"); p_mR(Ab, S5,P1,C10); put_zeroR_mR(Ab,Ab_free); printf(" Ab_free: put_zeroR_mR(); b FREEV"); p_mR(Ab_free, S5,P1,C10); stop(); clrscrn(); X_put_freeV_mR(Ab_free); printf(" See above for the function code: put_freeV_mR();\n\n\n" " Ab_free: b FREEV"); p_mR(Ab_free, S5,P1,C10); stop(); f_mR(Ab); f_mR(Ab_free); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Ab: b +1.0 -3.0 +4.5 -0.5 +4.0 +1.0 +0.0 -0.0 -0.0 +1.0 +3.0 -2.0 -6.0 -0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +5.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 Ab_free: put_zeroR_mR(); b FREEV +1.0 -3.0 +4.5 -0.5 +4.0 +1.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 -0.0 -0.0 +1.0 +3.0 -2.0 -6.0 -0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +5.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 Press return to continue. See above for the function code: put_freeV_mR(); Ab_free: b FREEV +1.0 -3.0 +4.5 -0.5 +4.0 +1.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +0.0 +0.0 -0.0 -0.0 +1.0 +3.0 -2.0 -6.0 -0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +0.0 +0.0 +0.0 +0.0 +1.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +5.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +1.0 +0.0 +0.0 +0.0 +1.0 Press return to continue.