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

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 : c00e.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double **A = r_mR( i_mR(r,r), 9); double **AT = transpose_mR(A, i_mR(r,r)); double **AplsAT = add_mR(A,AT, i_mR(r,r)); double **AmnsAT = sub_mR(A,AT, i_mR(r,r)); clrscrn(); printf(" A "); p_mR(A, S7,P3, C6); printf(" Symmetric matrix : A + AT "); p_mR(AplsAT, S7,P3, C6); printf(" Skew matrix : A - AT "); p_mR(AmnsAT, S7,P3, C6); f_mR(A); f_mR(AT); f_mR(AplsAT); f_mR(AmnsAT); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R4)+R1); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Let A be a square matrix: (A+AT) is symmetric, (A-AT) is a skew matrix Screen output example: A +3.000 +7.000 -7.000 +6.000 -9.000 +3.000 +1.000 +6.000 -1.000 +3.000 +8.000 +4.000 +9.000 +2.000 +7.000 +4.000 Symmetric matrix : A + AT +6.000 -2.000 -8.000 +15.000 -2.000 +6.000 +4.000 +8.000 -8.000 +4.000 +16.000 +11.000 +15.000 +8.000 +11.000 +8.000 Skew matrix : A - AT +0.000 +16.000 -6.000 -3.000 -16.000 +0.000 -2.000 +4.000 +6.000 +2.000 +0.000 -3.000 +3.000 -4.000 +3.000 +0.000 Press return to continue Press X return to stop