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

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 RCA RC4 /* ------------------------------------ */ void fun(void) { double **A = rPsymmetric_mR( i_mR(RCA,RCA),99); double **SqrtA = i_mR(RCA,RCA); double **EVector = i_mR(RCA,RCA); double **EVectorT = i_mR(RCA,RCA); double **EValue = i_mR(RCA,RCA); double **f_EValue = i_mR(RCA,RCA); double **T1 = i_mR(RCA,RCA); clrscrn(); printf(" A:"); p_mR(A, S7,P0, C8); eigs_V_mR(A,EVector); transpose_mR(EVector,EVectorT); /* EValue: EVectorT A EVector */ mul_mR(EVectorT,A,T1); mul_mR(T1,EVector,EValue); printf(" sqrt(A) = EVector sqrt(EValue) EVectorT\n"); f_eigs_mR(sqrt,EValue,f_EValue); mul_mR(EVector,f_EValue,T1); mul_mR(T1,EVectorT,SqrtA); p_mR(SqrtA,S10,P4,C8); printf(" A = sqrt(A) sqrt(A)"); mul_mR(SqrtA,SqrtA,A); p_mR(A, S7,P0, C8); f_mR(A); f_mR(SqrtA); f_mR(EVector); f_mR(EVectorT); f_mR(EValue); f_mR(f_EValue); f_mR(T1); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A: +8103 +4 -20 -70 +4 +2442 -58 -41 -20 -58 +8658 +57 -70 -41 +57 +3552 sqrt(A) = EVector sqrt(EValue) EVectorT +90.0154 +0.0271 -0.1082 -0.4675 +0.0271 +49.4135 -0.4061 -0.3746 -0.1082 -0.4061 +93.0467 +0.3721 -0.4675 -0.3746 +0.3721 +59.5945 A = sqrt(A) sqrt(A) +8103 +4 -20 -70 +4 +2442 -58 -41 -20 -58 +8658 +57 -70 -41 +57 +3552 Press return to continue Press X return to stop