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

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 : c00a.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RC RC3 /* ------------------------------------ */ int main(void) { double a[RC*RC] ={ 1,2,3, 5,4,1, 7,2,5}; /* ---------- Copy "a" into A --------- */ double **A = ca_A_mR(a,i_mR(RC,RC)); /* ------------------------------------ */ double **Inv = i_mR(RC,RC); double **ID = i_mR(RC,RC); clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(A,"A",P0); printf(" inv(A)\n\n\n\n"); printf(" inv(A):"); pE_mR(inv_mR(A,Inv), S12,P4,C3); printf(" A inv(A):"); p_mR(mul_mR(A,Inv,ID), S8,P4,C3); stop(); f_mR(ID); f_mR(Inv); f_mR(A); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave window. A=[ +1,+2,+3; +5,+4,+1; +7,+2,+5] inv(A) inv(A): -2.5000e-01 +5.5556e-02 +1.3889e-01 +2.5000e-01 +2.2222e-01 -1.9444e-01 +2.5000e-01 -1.6667e-01 +8.3333e-02 A inv(A): +1.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 -0.0000 -0.0000 +1.0000 Press return to continue.