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

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_rdiag_mR( double **A, int n ) { int r; isquare_mR(A,"rdiag_mR;","(A)"); m0_mR(A); for(r=R1; r<A[R_SIZE][C0]; r++) A[r][r] = r_I(n); return(A); } /* ------------------------------------ */ /* ------------------------------------ */ void fun(int rc) { double **A = rdiag_mR(i_mR(rc,rc),9); clrscrn(); printf(" rdiag_mR() : Diagonal matrix\n\n" " A[R%d,C%d] :",rsize_R(A),csize_R(A)); p_mR(A,S4,P0,C8); f_mR(A); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do fun(rp_I(RC8)); while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Diagonal matrix: Screen output example: rdiag_mR() : Diagonal matrix A[R4,C4] : -9 +0 +0 +0 +0 +2 +0 +0 +0 +0 -5 +0 +0 +0 +0 -1 Press return to continue Press X return to stop