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

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: c02c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RA R3 #define CA C5 /* ------------------------------------ */ #define FACTOR_E +1.E-6 /* ------------------------------------ */ void fun(void) { double **A = r_mR( i_mR(RA,CA),999999); double **Pinv = Pinv_Cn_mR(A, i_mR(CA,RA),FACTOR_E); double **Ide = mul_mR(A,Pinv, i_mR(RA,RA)); clrscrn(); printf(" A:"); p_mR(A, S13,P2,C7); printf(" PseudoInverse = V invS_T U_T "); pE_mR(Pinv, S13,P4,C10); printf(" Ide = A Pinv (The right 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 : +681786.00 +796558.00 -688542.00 +371486.00 -177999.00 +886803.00 +335689.00 +521163.00 -542720.00 -489630.00 -783037.00 -884829.00 +190434.00 +443997.00 -724191.00 PseudoInverse = V * invS_T * U_T +2.3763e-07 +4.2248e-07 -9.2123e-08 +2.9401e-07 +9.1179e-09 -2.6064e-07 -4.9559e-07 +4.1785e-07 -8.1152e-09 +4.9430e-07 -2.7190e-07 +3.5477e-07 -4.4344e-07 -5.2477e-07 -7.4742e-07 Ide = A * Pinv (The right 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