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

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 = i_Abr_Ac_bc_mR(RA,CA,Cb); double **invA = i_mR(RA,CA); clrscrn(); printf(" A :"); p_mR(A,S8,P0,C6); printf(" b : ID :"); p_mR(b,S8,P0,C6); stop(); clrscrn(); printf(" Ab :"); c_A_b_Ab_mR(A,b,Ab); p_mR(Ab,S8,P0,C6); printf(" gj_TP_mR(Ab) :"); gj_TP_mR(Ab); pE_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 -150 -148 +207 -215 +997 -858 +803 +289 b : ID : +1 +0 +0 +0 +1 +0 +0 +0 +1 Press return to continue. Ab : +10 -150 -148 +1 +0 +0 +207 -215 +997 +0 +1 +0 -858 +803 +289 +0 +0 +1 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.