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

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 : c00f2.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ #define RAb R4 #define CA C4 #define Cb C1 /* ------------------------------------ */ # define FREEV C3 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double ab[RAb*(CA+C1)]={ -1888.0, +674.0, -1554.0, -262.0, -1184.0, +2832.0, -1011.0, +2331.0, +393.0, +1776.0, -944.0, +337.0, -777.0, -131.0, -592.0, -3776.0, +1348.0, -3108.0, -524.0, -2368.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); double **b_free = i_mR(CA, Cb + FREEV); double **A = c_Ab_A_mR(Ab, i_mR(RAb, CA)); double **b = c_Ab_b_mR(Ab, i_mR(RAb, Cb)); double **Ax = i_mR(RAb, Cb + FREEV); clrscrn(); printf(" Ab:"); p_mR(Ab, S9,P3,C11); gj_PP_mR(Ab,NO); /* You can try with gj_PP_mR(Ab,YES); */ put_zeroR_mR(Ab,Ab_free); /* you get the same result!!! */ put_freeV_mR(Ab_free); gj_PP_mR(Ab_free,YES); c_Ab_b_mR(Ab_free,b_free); printf(" b:"); p_mR(b, S9,P3,C11); printf(" x:"); p_mR(b_free, S9,P3,C11); printf(" Ax:"); p_mR(mul_mR(A,b_free, Ax), S9,P3,C11); stop(); f_mR(Ab); f_mR(Ab_free); f_mR(b_free); f_mR(A); f_mR(b); f_mR(Ax); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ You can see that the vectors row of A are orthogonal to the vectors column of the free variables. <RowA,ColomnFreeV> = 0 Screen output example: Ab: -1888.000 +674.000 -1554.000 -262.000 -1184.000 +2832.000 -1011.000 +2331.000 +393.000 +1776.000 -944.000 +337.000 -777.000 -131.000 -592.000 -3776.000 +1348.000 -3108.000 -524.000 -2368.000 b: -1184.000 +1776.000 -592.000 -2368.000 x: +0.627 +0.357 -0.823 -0.139 +0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +1.000 Ax: -1184.000 +0.000 +0.000 +0.000 +1776.000 +0.000 +0.000 +0.000 -592.000 +0.000 +0.000 +0.000 -2368.000 +0.000 +0.000 +0.000 Press return to continue.