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

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 : c00c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ int main(void) { double a[R2*C3]={ 1,2,3, 4,5,6}; double b[R3*C2]={ 6,5, 3,2, 4,5}; double **A = ca_A_mR(a,i_mR(R2,C3)); double **B = ca_A_mR(b,i_mR(R3,C2)); double **AB = i_mR(R2,C2); clrscrn(); printf(" A : "); p_mR(A,S4,P0,C6); printf(" B : "); p_mR(B,S4,P0,C6); printf(" AB : "); p_mR(mul_mR(A,B,AB),S8,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(AB,S4,P0,C6); stop(); f_mR(A); f_mR(B); f_mR(AB); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : +1 +2 +3 +4 +5 +6 B : +6 +5 +3 +2 +4 +5 AB : +24 +24 +63 +60 Press return to continue. Copy/Paste into the octave window. A=[ +1,+2,+3; +4,+5,+6] B=[ +6,+5; +3,+2; +4,+5] A * B +24 +24 +63 +60 Press return to continue.