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

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: c00d.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double s = rp_I(8)+1; double **A = rsymmetric_mR( i_mR(r, r),99); double **EValueA = eigs_mR(A, i_mR(r,C1)); double **sA = smul_mR(s,A, i_mR(r, r)); double **EValuesA = eigs_mR(sA, i_mR(r,C1)); int i = 0; clrscrn(); printf(" A:"); p_mR(A,S3,P0,C6); printf(" EValue A:"); p_mR(EValueA,S13,P6,C1); printf(" %.0fA:",s); p_mR(sA,S4,P0,C6); printf(" EValue%.0fA:",s); p_mR(EValuesA,S13,P6,C1); stop(); clrscrn(); printf(" EValue%.0fA:",s); p_mR(EValuesA,S13,P6,C1); printf(" %.2f(EValuesA):\n",s); for(i=R1;i<=r;i++) printf(" %+12.6f \n", s*EValueA[i][C1]); f_mR(A); f_mR(EValueA); f_mR(sA); f_mR(EValuesA); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R2)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A: -79 -29 +92 +81 -29 +44 +32 -39 +92 +32 -59 +28 +81 -39 +28 -94 EValue A: -188.541294 -123.106223 +78.204908 +45.442609 5A: -395 -145 +460 +405 -145 +220 +160 -195 +460 +160 -295 +140 +405 -195 +140 -470 EValue5A: -942.706470 -615.531114 +391.024540 +227.213044 Press return to continue. EValue5A: -942.706470 -615.531114 +391.024540 +227.213044 5.00(EValuesA): -942.706470 -615.531114 +391.024540 +227.213044 Press return to continue Press X return to stop