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

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 C4 /* ------------------------------------ */ int main(void) { double a[RA*CA]={ +964, -689, +474, +948, +640, -693, -937, +656, -981, -337, -287, +420, -807, -123, +404, -177 }; double **A = ca_A_mR(a, i_mR(RA,CA)); double **InvA = invgj_mR(A, i_mR(RA,CA)); clrscrn(); printf(" A:"); p_mR(A,S8,P0,C6); printf(" invgj_mR(A,invA):"); pE_mR(InvA,S12,P4,C6); stop(); clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(A,"A",P0); printf(" inv(A):"); pE_mR(InvA,S12,P4,C6); stop(); f_mR(InvA); f_mR(A); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A: +964 -689 +474 +948 +640 -693 -937 +656 -981 -337 -287 +420 -807 -123 +404 -177 invgj_mR(A,invA): +1.2297e-04 +2.2103e-04 -6.6735e-04 -1.0573e-04 +1.2798e-05 -1.5789e-03 +1.2669e-03 -2.7770e-03 +5.4220e-04 -5.2536e-04 -2.0227e-04 +4.7693e-04 +6.6800e-04 -1.1096e-03 +1.7006e-03 -2.1493e-03 Press return to continue. Copy/Paste into the octave window. A=[ +964,-689,+474,+948; +640,-693,-937,+656; -981,-337,-287,+420; -807,-123,+404,-177] inv(A): +1.2297e-04 +2.2103e-04 -6.6735e-04 -1.0573e-04 +1.2798e-05 -1.5789e-03 +1.2669e-03 -2.7770e-03 +5.4220e-04 -5.2536e-04 -2.0227e-04 +4.7693e-04 +6.6800e-04 -1.1096e-03 +1.7006e-03 -2.1493e-03 Press return to continue.