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

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: c00b1.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ #define RC RC4 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double **B = r_Q_mR( i_mR(RC,RC), 9); double **invB = invgj_mR(B, i_mR(RC,RC)); double **x_S = r_mR( i_mR(RC,C1),9.); double **x_B = mul_mR(invB,x_S, i_mR(RC,C1)); clrscrn(); printf(" B is the basis change matrix for the basis \"B\" \n\n" " B: orthonormal matrix"); p_mR(B, S10,P4,C7); printf("invB: invB = transpose of B"); p_mR(invB, S10,P4,C7); stop(); clrscrn(); printf(" x_S: Standart basis"); p_mR(x_S, S10,P4,C6); printf(" Compute x_S in the B basis:\n\n" " x_B = invB x_S:"); p_mR(x_B, S10,P4,C7); f_mR(x_S); f_mR(B); f_mR(invB); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: B is the basis change matrix for the basis "B" B: orthonormal matrix -0.7127 -0.6589 +0.1069 -0.2156 +0.4454 -0.2490 -0.2341 -0.8275 -0.5345 +0.6107 -0.4776 -0.3364 +0.0891 -0.3618 -0.8400 +0.3944 invB: invB = transpose of B -0.7127 +0.4454 -0.5345 +0.0891 -0.6589 -0.2490 +0.6107 -0.3618 +0.1069 -0.2341 -0.4776 -0.8400 -0.2156 -0.8275 -0.3364 +0.3944 Press return to continue. x_S: Standart basis +9.0000 -1.0000 -9.0000 +4.0000 Compute x_S in the B basis: x_B = invB x_S: -1.6927 -12.6247 +2.1352 +3.4917 Press return to continue Press X return to stop