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

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 fun(int r) { double trA; double trB; double **A = r_mR(i_mR(r,r),9); double **B = r_mR(i_mR(r,r),9); double **AplsB = i_mR(r,r); clrscrn(); printf(" A:"); p_mR(A, S5,P0,C6); printf(" B:"); p_mR(B, S5,P0,C6); trA = trace_R(A); trB = trace_R(B); printf(" Trace(A)+Trace(B) = %+.0f %+.0f \t= %+.0f \n", trA, trB, (trA+trB)); printf(" Trace(A+B) \t\t= %+.0f \n\n", trace_R(add_mR(A,B,AplsB))); f_mR(A); f_mR(B); f_mR(AplsB); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do{ fun(rp_I(RC4)+RC2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ trace_R(A+B) = trace_R(A) + trace_R(B): Screen output example: A: +7 +7 +4 -8 +9 -1 -6 -3 +4 B: +6 +2 -5 +8 -3 -7 -6 -6 +2 Trace(A)+Trace(B) = +20 +5 = +25 Trace(A+B) = +25 Press return to continue Press X return to stop