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

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: c00e2.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ #define RC RC3 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double tu[RC*C1]={ -7, -6, +8 }; double tv[RC*C1]={ -5, -4, +7 }; double tQ[RC*RC]={ +0.301511344578, +0.275240941282, -0.912870929175, +0.301511344578, -0.935819200357, -0.182574185835, -0.904534033733, -0.220192753025, -0.365148371670, }; double **u = ca_A_mR(tu, i_mR(RC,C1)); double **v = ca_A_mR(tv, i_mR(RC,C1)); double **Q = ca_A_mR(tQ, i_mR(RC,RC)); double **Qu = mul_mR(Q,u, i_mR(RC,C1)); double **Qv = mul_mR(Q,v, i_mR(RC,C1)); clrscrn(); printf(" Q: an orthonormal matrix "); p_mR(Q, S3,P5,C6); printf(" u:"); p_mR(u, S3,P1,C6); printf(" v:"); p_mR(v, S3,P1,C6); printf(" Orthonormal matrices preserve the dot product\n\n" " Q u . Q v\t = u . v \n\n" " %.4f\t = %.4f \n\n", dot_R(Qu, Qv), dot_R(u,v)); stop(); f_mR(u); f_mR(v); f_mR(Qu); f_mR(Qv); f_mR(Q); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: Q: an orthonormal matrix +0.30151 +0.27524 -0.91287 +0.30151 -0.93582 -0.18257 -0.90453 -0.22019 -0.36515 u: -7.0 -6.0 +8.0 v: -5.0 -4.0 +7.0 Orthonormal matrices preserve the dot product Q u . Q v = u . v 115.0000 = 115.0000 Press return to continue.