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

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: c00f.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RA R3 #define CA C3 #define Cb C3 /* ------------------------------------ */ int main(void) { double at[RA*CA]={ +10, -150, -148, +207, -215, +997, -858, +803, +289 }; double **A = ca_A_mR(at, i_mR(RA,CA)); double **b = eye_mR( i_mR(RA,Cb)); double **Ab = c_A_b_Ab_mR(A,b, i_Abr_Ac_bc_mR(RA,CA,Cb)); double **invA = i_mR(RA,CA); clrscrn(); printf(" A:"); p_mR(A, S8,P2,C6); printf(" b: ID:"); p_mR(b, S8,P2,C6); printf(" Ab:"); p_mR(Ab, S8,P2,C6); printf(" gj_TP_mR(Ab):"); pE_mR(gj_TP_mR(Ab), S12,P4,C6);; stop(); clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(A,"A",P0); printf("format short e\n"); printf(" inv(A)\n\n"); printf(" invA: c_Inv_A_mR(Ab,invA);"); c_Inv_A_mR(Ab,invA); pE_mR(invA, S12,P4,C6); stop(); f_mR(invA); f_mR(Ab); f_mR(b); f_mR(A); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A: +10.00 -150.00 -148.00 +207.00 -215.00 +997.00 -858.00 +803.00 +289.00 b: ID: +1.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +1.00 Ab: +10.00 -150.00 -148.00 +1.00 +0.00 +0.00 +207.00 -215.00 +997.00 +0.00 +1.00 +0.00 -858.00 +803.00 +289.00 +0.00 +0.00 +1.00 gj_TP_mR(Ab): +1.0000e+00 +0.0000e+00 -0.0000e+00 -6.5676e-03 -5.7471e-04 -1.3807e-03 -0.0000e+00 +1.0000e+00 -0.0000e+00 -6.9674e-03 -9.4468e-04 -3.0912e-04 +0.0000e+00 +0.0000e+00 +1.0000e+00 -1.3892e-04 +9.1861e-04 +2.2000e-04 Press return to continue. Copy/Paste into the octave window. A=[ +10,-150,-148; +207,-215,+997; -858,+803,+289] format short e inv(A) invA: c_Inv_A_mR(Ab,invA); -6.5676e-03 -5.7471e-04 -1.3807e-03 -6.9674e-03 -9.4468e-04 -3.0912e-04 -1.3892e-04 +9.1861e-04 +2.2000e-04 Press return to continue.