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

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 RCn RC3 /* ------------------------------------ */ int main(void) { double ta[RCn*RCn] ={ 1,2,3, 5,4,1, 7,2,5}; double **A = ca_A_mR(ta, i_mR(RCn,RCn)); double **Inv = inv_mR(A, i_mR(RCn,RCn)); double **ID = mul_mR(Inv,A, i_mR(RCn,RCn)); clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(A,"A",P0); printf(" inv(A)\n"); pE_mR(Inv, S12,P4,C5); printf(" inv(A) A:"); p_mR(ID, S0,P4,C8); 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) -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 Press return to continue. inv(A)*A +1.0000 -0.0000 +0.0000 +0.0000 +1.0000 +0.0000 -0.0000 +0.0000 +1.0000 Press return to continue.