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

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 RCA RC4 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double a[RCA*RCA] ={ +0.812500000000, -0.656250000000, -1.406250000000, -0.656250000000, -0.250000000000, +0.125000000000, -1.875000000000, -0.875000000000, +0.125000000000, +0.437500000000, +1.937500000000, +0.437500000000, -0.250000000000, -0.875000000000, -1.875000000000, +0.125000000000 }; /* You can choose the value of the point P */ double P[RCA*C1] ={ +2, +5, +6, +3, }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **p = ca_A_mR(P, i_mR(RCA,C1)); double **Pp = mul_mR(A,p, i_mR(RCA,C1));; clrscrn(); printf(" A :"); p_mR(A, S9,P12, C4); printf(" You can choose the value of the point p\n\n" " p:"); p_mR(p, S9,P1, C4); printf(" The projection of p on the hyperplan defined by v1," " v2 and v3.\n\n" " Pp: Copy this matrix into c00e.c"); P_mR(Pp, 18,P12, C4); stop(); f_mR(A); f_mR(p); f_mR(Pp); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ /* ------------------------------------ */ You can calculate the projection of a point P onto the hyperplan. Screen output example: A : +0.812500000000 -0.656250000000 -1.406250000000 -0.656250000000 -0.250000000000 +0.125000000000 -1.875000000000 -0.875000000000 +0.125000000000 +0.437500000000 +1.937500000000 +0.437500000000 -0.250000000000 -0.875000000000 -1.875000000000 +0.125000000000 You can choose the value of the point p p: +2.0 +5.0 +6.0 +3.0 The projection of p on the hyperplan defined by v1, v2 and v3. Pp: Copy this matrix into c00e.c -12.062500000000, -13.750000000000, +15.375000000000, -15.750000000000 Press return to continue.