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

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" /* ------------------------------------ */ void fun(int rc) { double s = r_I(9); double **A = r_mR( i_mR(rc,rc),9); double **sA = smul_mR(s,A,i_mR(rc,rc) ); clrscrn(); printf("A:"); p_mR(A, S3,P0,C6); printf(" %.0f * A:",s); p_mR(sA, S3,P0,C6); printf("\n" " Trace(sA) = %+.0f\n" " %+.0f * Trace( A) = %+.0f\n", trace_R(sA), s, s*trace_R(A)); f_mR(A); f_mR(sA); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do fun(rp_I(RC5)); while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ trace(sA) = s*trace(A): Screen output example: A: +3 -4 +3 +3 -8 +9 +5 +7 -2 -5 * A: -15 +20 -15 -15 +40 -45 -25 -35 +10 Trace(sA) = +35 -5 * Trace( A) = +35 Press return to continue Press X return to stop