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

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 : c00b.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 trace.\n\n"); 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; } /* ------------------------------------ */ /* ------------------------------------ */ Similar matrices have the same trace. Screen output example: Similar matrices have the same trace. A[0] : trace = -165.0000 +7.00 -7.00 +60.00 -7.00 -80.00 -56.00 +60.00 -56.00 -92.00 A[1] : trace = -165.0000 +103.09 -139.06 +162.85 -261.21 +186.50 -284.36 -322.58 +336.14 -454.59 A[2] : trace = -165.0000 -0.47 +62.65 -43.33 -275.89 -307.30 +126.09 -269.54 -297.92 +142.77 Press return to continue Press X return to stop