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

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 : c00f.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define ARRAY A4 /* ------------------------------------ */ #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[A0],99); /* A[n] similar matrices */ for(i=A0; i<(ARRAY-A1); i++) { mul_mR(InvP[i],A[i],T); mul_mR(T,P[i],A[i+C1]); } clrscrn(); printf(" Let A[0], A[1], ... be a set of similar matrices.\n\n\n\n"); stop(); clrscrn(); for(i=A0; i<ARRAY; i++) { printf(" A[%d] : \t\t\t trace = %+.4f ",i,trace_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; } /* ------------------------------------ */ /* ------------------------------------ */ The traces of similar matrices: Screen output example: Let A[0], A[1], ... be a set of similar matrices. Press return to continue. A[0] : trace = +65.0000 -8.00 +90.00 -60.00 +90.00 -15.00 +63.00 -60.00 +63.00 +88.00 A[1] : trace = +65.0000 +410.41 -108.00 +642.45 -239.44 +158.02 -464.44 -312.47 +62.12 -503.43 A[2] : trace = +65.0000 +47.98 +3.38 +67.30 +2237.43 +8.60 -860.04 +103.49 -4.56 +8.43 A[3] : trace = +65.0000 +625.79 +922.27 +206.84 -154.49 -303.33 -47.06 -898.08 -1550.41 -257.46 Press return to continue Press X return to stop