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

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 : c00d.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define FACTOR_E +1.E-5 /* ------------------------------------ */ void fun(int r,int c) { double **B = r_mR( i_mR(c,r),99999.); double **Pinv = Pinv_Rn_mR(B, i_mR(r,c),FACTOR_E); double **PinvB = mul_mR(Pinv,B, i_mR(r,r)); clrscrn(); printf(" Copy/Paste into the octave windows \n\n\n"); p_Octave_mR(B,"B",P2); printf("pinv(B)\n\n\n"); stop(); clrscrn(); printf(" Pinv = V invS_T U_T "); pE_mR(Pinv,S12,P4,C10); printf(" Ide = Pinv B "); p_mR(PinvB,S10,P6,C10); f_mR(B); f_mR(Pinv); f_mR(PinvB); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); int i; do { i = rp_I(R2)+R1; fun(i,i+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave windows B=[ -68190.00,+54828.00,+46667.00; +16277.00,+84306.00,+28568.00; +67372.00,+82585.00,+45071.00; +54863.00,-41159.00,+71427.00; -71477.00,+81278.00,-74086.00] pinv(B) Press return to continue. Pinv = V invS_T U_T -7.9358e-06 +1.3469e-06 +5.0941e-06 +3.5079e-07 -1.0422e-06 +7.2578e-07 +3.6124e-06 +4.2543e-06 -1.5167e-06 +2.9761e-06 +7.8459e-06 +1.0701e-06 -1.4956e-07 +4.3334e-06 -4.0562e-06 Ide = Pinv B +1.000000 +0.000000 +0.000000 +0.000000 +1.000000 +0.000000 +0.000000 -0.000000 +1.000000 Press return to continue Press X return to stop