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

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" /* ------------------------------------ */ #define RA R4 #define CA C6 #define Cb C1 #define RB R3 /* B : a basis for the rows space of A */ /* ------------------------------------ */ int main(void) { double ab[RA*(CA+Cb)]={ +13, -65, +39, -104, +26, +26, +0, +30, -54, +36, -54, +36, +12, +0, +35, -63, +42, -63, +42, +49, +0, -11, +55, -33, +88, -22, -22, +0 }; double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(RA,CA,Cb)); double **A = c_Ab_A_mR(Ab, i_mR(RA,CA)); double **b = c_Ab_b_mR(Ab, i_mR(RA,Cb)); double **B = i_mR(RB,CA); clrscrn(); printf("Basis for a Row Space by Row Reduction :\n\n"); printf(" A :"); p_mR(A,S6,P1,C10); printf(" b :"); p_mR(b,S6,P1,C10); printf(" Ab :"); p_mR(Ab,S6,P1,C10); stop(); clrscrn(); printf(" The nonzero rows vectors of Ab without b\n" " form a basis for the row space of A \n\n" " Ab :"); p_mR(Ab,S7,P3,C10); printf(" gj_PP_mR(Ab,NO) :"); gj_PP_mR(Ab,NO); p_mR(Ab,S7,P3,C10); c_Ab_A_mR(Ab,A); c_r_mR(A,R1,B,R1); c_r_mR(A,R2,B,R2); c_r_mR(A,R3,B,R3); printf(" B : Basis for a Row Space of A by Row Reduction"); p_mR(B,S7,P3,C10); stop(); f_mR(Ab); f_mR(b); f_mR(A); f_mR(B); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ The position of the pivots of Ab gives the position of the rows of A which form a basis for the row space of A. Screen output example: Basis for a Row Space by Row Reduction : A : +13.0 -65.0 +39.0 -104.0 +26.0 +26.0 +30.0 -54.0 +36.0 -54.0 +36.0 +12.0 +35.0 -63.0 +42.0 -63.0 +42.0 +49.0 -11.0 +55.0 -33.0 +88.0 -22.0 -22.0 b : +0.0 +0.0 +0.0 +0.0 Ab : +13.0 -65.0 +39.0 -104.0 +26.0 +26.0 +0.0 +30.0 -54.0 +36.0 -54.0 +36.0 +12.0 +0.0 +35.0 -63.0 +42.0 -63.0 +42.0 +49.0 +0.0 -11.0 +55.0 -33.0 +88.0 -22.0 -22.0 +0.0 Press return to continue. The nonzero rows vectors of Ab without b form a basis for the row space of A Ab : +13.000 -65.000 +39.000 -104.000 +26.000 +26.000 +0.000 +30.000 -54.000 +36.000 -54.000 +36.000 +12.000 +0.000 +35.000 -63.000 +42.000 -63.000 +42.000 +49.000 +0.000 -11.000 +55.000 -33.000 +88.000 -22.000 -22.000 +0.000 gj_PP_mR(Ab,NO) : +1.000 -1.800 +1.200 -1.800 +1.200 +1.400 +0.000 -0.000 +1.000 -0.563 +1.938 -0.250 -0.188 -0.000 -0.000 -0.000 -0.000 -0.000 -0.000 +1.000 -0.000 +0.000 +0.000 +0.000 -0.000 +0.000 +0.000 +0.000 B : Basis for a Row Space of A by Row Reduction +1.000 -1.800 +1.200 -1.800 +1.200 +1.400 -0.000 +1.000 -0.563 +1.938 -0.250 -0.188 -0.000 -0.000 -0.000 -0.000 -0.000 +1.000 Press return to continue.