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

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" /* ------------------------------------ */ void fun(int r,int c) { double **A = r_mR(i_mR(r,c),9); double **B = r_mR(i_mR(r,c),9); double **AmnsB = i_mR(r,c); clrscrn(); printf(" A : "); p_mR(A,S4,P0,C6); printf(" B : "); p_mR(B,S4,P0,C6); printf(" A - B : "); p_mR(sub_mR(A,B,AmnsB),S4,P0,C6); stop(); clrscrn(); printf(" Copy/Paste into the octave window.\n\n"); p_Octave_mR(A,"A", P0); p_Octave_mR(B,"B", P0); printf("A - B\n"); p_mR(AmnsB,S4,P0,C6); f_mR(A); f_mR(B); f_mR(AmnsB); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do fun(rp_I(R4),rp_I(C4)+C2); while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : -3 +2 +2 -3 +4 +6 +5 -7 +6 +7 -9 -5 +3 -7 -9 -4 B : +7 -9 +8 +6 +9 -8 +5 -4 +3 -3 +1 -5 +7 +5 -8 +6 A - B : -10 +11 -6 -9 -5 +14 +0 -3 +3 +10 -10 +0 -4 -12 -1 -10 Press return to continue. Copy/Paste into the octave window. A=[ -3,+2,+2,-3; +4,+6,+5,-7; +6,+7,-9,-5; +3,-7,-9,-4] B=[ +7,-9,+8,+6; +9,-8,+5,-4; +3,-3,+1,-5; +7,+5,-8,+6] A - B -10 +11 -6 -9 -5 +14 +0 -3 +3 +10 -10 +0 -4 -12 -1 -10 Press return to continue Press X return to stop