matmult                 package:base                 R Documentation

_M_a_t_r_i_x _M_u_l_t_i_p_l_i_c_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Multiplies two matrices, if they are conformable. If one argument
     is a vector, it will be promoted to either a row or column matrix
     to make the two arguments conformable. If both are vectors it will
     return the inner product.

_U_s_a_g_e:

     a %*% b

_A_r_g_u_m_e_n_t_s:

    a, b: numeric or complex matrices or vectors.

_D_e_t_a_i_l_s:

     When a vector is promoted to a matrix, its names are not promoted
     to row or column names, unlike 'as.matrix'.

_V_a_l_u_e:

     The matrix product.  Use 'drop' to get rid of dimensions which
     have only one level.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'matrix', 'Arithmetic', 'diag'.

_E_x_a_m_p_l_e_s:

     x <- 1:4
     (z <- x %*% x)    # scalar ("inner") product (1 x 1 matrix)
     drop(z)             # as scalar

     y <- diag(x)
     z <- matrix(1:12, ncol = 3, nrow = 4)
     y %*% z
     y %*% x
     x %*% z

