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

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" /* ------------------------------------ */ /* ------------------------------------ */ double **X_rskewsymmetric_mR( double **A, int n) { int r; int c; double x; isquare_mR(A,"rskewsymmetric_mR();","(A)"); for ( r=R1; r<A[R_SIZE][C0]; r++) for ( c=C1; c<A[C_SIZE][C0]; c++) { if(r==c) A[r][c] = 0.; else{ x = r_I (n); A[r][c] = -x; A[c][r] = x; } } return(A); } /* ------------------------------------ */ /* ------------------------------------ */ void fun(int r) { double **A = rskewsymmetric_mR( i_mR(r,r), 9); double **AT = transpose_mR(A, i_mR(r,r)); double **mns1A = smul_mR(-1,A, i_mR(r,r)); clrscrn(); printf(" Skew-symmetric matrix : -A = AT\n\n\n"); printf(" -A:"); p_mR(mns1A, S7,P3,C6); printf(" AT:"); p_mR(AT, S7,P3,C6); f_mR(A); f_mR(AT); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R3)+R1); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Skew-symmetric matrix : -A = AT -A: -0.000 +2.000 -9.000 -2.000 -0.000 -6.000 +9.000 +6.000 -0.000 AT: +0.000 +2.000 -9.000 -2.000 +0.000 -6.000 +9.000 +6.000 +0.000 Press return to continue Press X return to stop