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

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" /* ------------------------------------ */ void fun(int r) { double **A = rdefinite_positive_mR( i_mR(r,r), 99); double **TA = i_mR(r,r); double **V = i_mR(r,r); double **VT = i_mR(r,r); double **EValue = i_mR(r,r); double **T = i_mR(r,r); clrscrn(); printf(" Let's check that A = V * EValue * VT.\n\n" " A:"); p_mR(A, S10,P2,C6); /* Eigenvector */ eigs_V_mR(A,V); transpose_mR(V,VT); /* Eigenvalue = VT * A * V */ mul_mR(VT,A,T); mul_mR(T,V,EValue); printf(" TA = V EValue VT"); mul_mR(V,EValue,T); mul_mR(T,VT,TA); p_mR(TA, S10,P2,C6); printf(" A - TA = 0"); sub_mR(A,TA,T); p_mR(T, S10,P6,C6); f_mR(A); f_mR(TA); f_mR(V); f_mR(VT); f_mR(EValue); f_mR(T); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R2)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Let's check that A = V * EValue * VT. Screen output example: Let's check that A = V * EValue * VT. A: +14637.00 +8674.00 +1288.00 +1887.00 +8674.00 +14269.00 +4717.00 +4111.00 +1288.00 +4717.00 +7730.00 -2239.00 +1887.00 +4111.00 -2239.00 +15123.00 TA = V EValue VT +14637.00 +8674.00 +1288.00 +1887.00 +8674.00 +14269.00 +4717.00 +4111.00 +1288.00 +4717.00 +7730.00 -2239.00 +1887.00 +4111.00 -2239.00 +15123.00 A - TA = 0 -0.000000 -0.000000 -0.000000 +0.000000 -0.000000 -0.000000 -0.000000 +0.000000 -0.000000 -0.000000 +0.000000 -0.000000 +0.000000 +0.000000 -0.000000 +0.000000 Press return to continue Press X return to stop