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

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" /* ------------------------------------ */ #define ARRAY A3 #define RCA R3 /* ------------------------------------ */ void fun(void) { double **A[ARRAY]; double **P[ARRAY]; double **InvP[ARRAY]; double **T = i_mR(RCA,RCA); int i; for(i=A0; i<ARRAY; i++) { A[i] = i_mR(RCA,RCA); P[i] = r_mR( i_mR(RCA,RCA),99); InvP[i] = inv_mR(P[i], i_mR(RCA,RCA)); } rsymmetric_mR(A[0],99); for(i=A0; i<(ARRAY-C1); i++) { mul_mR(InvP[i],A[i],T); mul_mR(T,P[i],A[i+C1]); } clrscrn(); printf(" Similar matrices have the same determinant.\n\n"); for(i=A0; i<ARRAY; i++) { printf(" A[%d] : \t\t\t det = %+.4f ",i,det_R(A[i])); p_mR(A[i], S9,P2,C6); } for(i=A0; i<ARRAY; i++) { f_mR(A[i]); f_mR(P[i]); f_mR(InvP[i]); } f_mR(T); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do{ fun(); }while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Similar matrices have the same determinant. Screen output example: Similar matrices have the same determinant. A[0] : det = +486540.0000 -93.00 -53.00 -56.00 -53.00 +36.00 +56.00 -56.00 +56.00 +4.00 A[1] : det = +486540.0000 -178.28 -171.13 +69.73 +508.59 +360.48 -99.42 +1045.33 +807.93 -235.20 A[2] : det = +486540.0000 +2307.80 +8471.32 -11396.81 +1322.25 +4980.51 -6657.96 +1460.93 +5489.74 -7341.31 Press return to continue Press X return to stop