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

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: c01c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RA R5 #define CA C3 /* ------------------------------------ */ #define FACTOR_E +1.E-6 /* ------------------------------------ */ void fun(void) { double **A = r_mR( i_mR(RA,CA),999999); double **Pinv = Pinv_Rn_mR(A, i_mR(CA,RA),FACTOR_E);; double **Ide = mul_mR(Pinv,A, i_mR(CA,CA)); ; clrscrn(); printf(" A:"); p_mR(A, S13,P2,C7); printf(" Pinv = V invS_T U_T "); pE_mR(Pinv, S13,P4,C10); printf(" Ide = Pinv A (The left inverse of A)"); p_mR(Ide, S7,P2,C10); f_mR(A); f_mR(Pinv); f_mR(Ide); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : -995227.00 -226139.00 -703009.00 +108243.00 +588588.00 +285819.00 +996770.00 -664334.00 -943657.00 +888060.00 +643156.00 +411191.00 -651933.00 +555244.00 -100982.00 Pinv = V * invS_T * U_T -2.5771e-07 +7.8043e-08 +3.6977e-07 +3.2410e-07 -1.2069e-07 +2.5404e-07 +5.5658e-07 +1.6320e-07 +6.1718e-07 +7.9483e-07 -5.7204e-07 -2.2997e-07 -7.3835e-07 -2.2963e-07 -6.0662e-07 Ide = Pinv * A (The left inverse of A) +1.00 -0.00 -0.00 +0.00 +1.00 +0.00 +0.00 -0.00 +1.00 Press return to continue Press X return to stop