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

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 : c00b.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ int main(void) { double u_T[R1*C3] = { 4, 2, 5}; double v_T[R1*C3] = { 3, 4, 1}; double w_T[R1*C3] = { 5, 1, 3}; double **U_T = ca_A_mR(u_T, i_mR(R1,C3)); double **V_T = ca_A_mR(v_T, i_mR(R1,C3)); double **W_T = ca_A_mR(w_T, i_mR(R1,C3)); double **UxV = UxV_mR(U_T,V_T, i_mR(R1,C3)); double **UxW = UxV_mR(U_T,W_T, i_mR(R1,C3)); double **UxV_pls_UxW = add_mR(UxV,UxW, i_mR(R1,C3)); double **VplusW = add_mR(V_T,W_T, i_mR(R1,C3)); double **Ux_VplusW = UxV_mR(U_T,VplusW, i_mR(R1,C3)); clrscrn(); printf(" u_T:"); p_mR(U_T, S4, P0, C6); printf(" v_T:"); p_mR(V_T, S4, P0, C6); printf(" w_T:"); p_mR(W_T, S4, P0, C6); printf("\n\n\n"); printf(" u x (v+w):"); p_mR(Ux_VplusW, S5, P0, C6); printf(" (uxv) + (uxw):"); p_mR(UxV_pls_UxW, S5, P0, C6); stop(); f_mR(U_T); f_mR(V_T); f_mR(W_T); f_mR(UxV); f_mR(UxW); f_mR(UxV_pls_UxW); f_mR(VplusW); f_mR(Ux_VplusW); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ u x (v+w) == (uxv) + (uxw):. Screen output example: u_T : +4 +2 +5 v_T : +3 +4 +1 w_T : +5 +1 +3 u x (v+w) : -17 +24 +4 (uxv) + (uxw) : -17 +24 +4 Press return to continue. Press X return to stop