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

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" /* ------------------------------------ */ void AplsB(int r) { double **A = i_mR(r,r); double **B = i_mR(r,r); double **C = i_mR(r,r); double **T = i_mR(r,r); double **AB = i_mR(r,r); double **BA = i_mR(r,r); r_commute3_mR(A,B,C,9); clrscrn(); printf(" A:"); p_mR(A, S5,P3,C6); printf(" B:"); p_mR(B, S5,P3,C6); printf(" C:"); p_mR(C, S5,P3,C6); stop(); clrscrn(); printf(" AB:"); p_mR(mul_mR(A,B,AB), S5,P9,C6); printf(" BA:"); p_mR(mul_mR(B,A,BA), S5,P9,C6); stop(); clrscrn(); printf(" AC:"); p_mR(mul_mR(A,C,AB), S5,P9,C6); printf(" CA:"); p_mR(mul_mR(C,A,BA), S5,P9,C6); stop(); clrscrn(); printf(" BC:"); p_mR(mul_mR(B,C,AB), S5,P9,C6); printf(" CB:"); p_mR(mul_mR(C,B,BA), S5,P9,C6); f_mR(A); f_mR(B); f_mR(C); f_mR(AB); f_mR(BA); f_mR(T); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { AplsB(RC3); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Three commutative matrices: Screen output example: A: +0.111 -0.904 -0.196 -0.479 -0.003 -0.507 -0.565 -0.974 +0.549 B: +0.548 -0.154 -0.540 -0.385 -0.060 +0.300 -0.154 +0.034 -0.026 C: +0.011 -0.008 -0.010 -0.009 +0.001 +0.001 -0.006 -0.006 +0.006 Press return to continue. AB: +0.439672072 +0.030252125 -0.325972538 -0.183482673 +0.056768556 +0.270665775 -0.019102730 +0.164191338 -0.001136950 BA: +0.439672072 +0.030252125 -0.325972538 -0.183482673 +0.056768556 +0.270665775 -0.019102730 +0.164191338 -0.001136950 Press return to continue. AC: +0.010760400 -0.000916121 -0.003206424 -0.002290303 +0.007146811 +0.001781346 -0.000916121 +0.000203582 +0.007350394 CA: +0.010760400 -0.000916121 -0.003206424 -0.002290303 +0.007146811 +0.001781346 -0.000916121 +0.000203582 +0.007350394 Press return to continue. BC: +0.010997165 -0.001576084 -0.008444885 -0.005697364 +0.001374547 +0.005299014 -0.001910780 +0.001509281 +0.001377696 CB: +0.010997165 -0.001576084 -0.008444885 -0.005697364 +0.001374547 +0.005299014 -0.001910780 +0.001509281 +0.001377696 Press return to continue Press X return to stop