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

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 **A = r_mR( i_mR(r,c),99999.); double **Pinv = Pinv_Cn_mR(A, i_mR(c,r),FACTOR_E); double **Ide = mul_mR(A,Pinv, i_mR(r,r)); clrscrn(); printf(" Copy/Paste into the octave windows \n\n\n"); p_Octave_mR(A,"A",P2); printf("pinv(A)\n\n\n"); stop(); clrscrn(); printf(" Pinv = V invS_T U_T "); pE_mR(Pinv,S12,P4,C10); printf(" Ide = A Pinv"); p_mR(Ide,S10,P6,C10); f_mR(A); f_mR(Pinv); f_mR(Ide); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); int i; do { i = rp_I(R3)+R1; fun(i,i+C3); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Copy/Paste into the octave windows A=[ +38529.00,+16644.00,+30908.00,-35337.00,-34628.00,-72897.00,-50057.00; +20658.00,-49492.00,+43433.00,-83263.00,-31134.00,+63462.00,+78069.00; +12935.00,+43203.00,-37124.00,-17738.00,+1352.00,-88430.00,+63252.00; -78739.00,+9366.00,-1933.00,-77534.00,+64564.00,-43048.00,-94247.00] pinv(A) Press return to continue. Pinv = V invS_T U_T +4.8109e-06 +1.9045e-07 -6.5455e-07 -3.8278e-06 +1.3634e-07 -1.9080e-06 +2.4002e-06 -1.2234e-07 +3.9803e-06 +1.9427e-06 -3.0888e-06 -4.4616e-07 -1.7334e-06 -5.5783e-06 -2.0126e-06 -4.1986e-06 -4.5721e-06 -7.7480e-07 +1.3548e-06 +3.1231e-06 -3.5930e-06 +1.5166e-06 -4.5640e-06 -6.3738e-07 -4.1524e-06 +2.9770e-06 +5.5172e-06 -1.5308e-06 Ide = A Pinv +1.000000 -0.000000 +0.000000 -0.000000 -0.000000 +1.000000 +0.000000 -0.000000 +0.000000 +0.000000 +1.000000 +0.000000 -0.000000 -0.000000 -0.000000 +1.000000 Press return to continue Press X return to stop