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

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" /* ------------------------------------ */ void fun(int r,int rn) { double **A = r_mR(i_mR(r+rn,r),9.); double **Q = i_mR(r+rn,r); double **R = i_mR(r,r); clrscrn(); printf(" A :"); P_mR(A,S3,P0,C6); printf(" Copy/Paste into the octave windows \n\n"); p_Octave_mR(A,"a",P0); printf(" [Q, R] = qr (a,0) \n\n"); stop(); clrscrn(); QR_mR(A,Q,R); printf(" Q :"); p_mR(Q,S10,P6,C6); printf(" R :"); p_mR(R,S10,P6,C6); stop(); clrscrn(); printf(" A :"); p_mR(A,S3,P0,C6); printf(" A = Q * R :"); mul_mR(Q,R, A); p_mR(A,S10,P4,C6); f_mR(A); f_mR(Q); f_mR(R); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R3),rp_I(C2)); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : -8, -3, -1, -3, +3, -4, +1, -3, -9, -8, +6, -2, -2, +1, +3 Copy/Paste into the octave windows a=[ -8,-3,-1; -3,+3,-4; +1,-3,-9; -8,+6,-2; -2,+1,+3] [Q, R] = qr (a,0) Press return to continue. Q : -0.671345 -0.700678 +0.154918 -0.251754 +0.299468 -0.407390 +0.083918 -0.372415 -0.824559 -0.671345 +0.525988 -0.182945 -0.167836 +0.063349 +0.310913 R : +11.916375 -3.188889 +1.762281 -0.000000 +7.336960 +1.992612 -0.000000 +0.000000 +10.194305 Press return to continue. A : -8 -3 -1 -3 +3 -4 +1 -3 -9 -8 +6 -2 -2 +1 +3 A = Q * R : -8.0000 -3.0000 -1.0000 -3.0000 +3.0000 -4.0000 +1.0000 -3.0000 -9.0000 -8.0000 +6.0000 -2.0000 -2.0000 +1.0000 +3.0000 Press return to continue Press X return to stop