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

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" /* ------------------------------------ */ int main(void) { double a[R2*C3]={ 1,2,3, 4,5,6}; double b[R2*C3]={ 6,5,4, 3,2,1}; double **A = ca_A_mR(a,i_mR(R2,C3)); double **B = ca_A_mR(b,i_mR(R2,C3)); double **AmnsB = i_mR(R2,C3); 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); stop(); f_mR(A); f_mR(B); f_mR(AmnsB); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : +1 +2 +3 +4 +5 +6 B : +6 +5 +4 +3 +2 +1 A - B : -5 -3 -1 +1 +3 +5 Press return to continue. Copy/Paste into the octave window. A=[ +1,+2,+3; +4,+5,+6] B=[ +6,+5,+4; +3,+2,+1] A - B -5 -3 -1 +1 +3 +5 Press return to continue.