kronecker                package:base                R Documentation

_K_r_o_n_e_c_k_e_r _p_r_o_d_u_c_t_s _o_n _a_r_r_a_y_s

_D_e_s_c_r_i_p_t_i_o_n:

     Computes the generalised kronecker product of two arrays, `X' and
     `Y'.  `kronecker(X, Y)' returns an array `A' with dimensions
     `dim(X) * dim(Y)'.

_U_s_a_g_e:

     kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)
     X %x% Y

_A_r_g_u_m_e_n_t_s:

       X: A vector or array.

       Y: A vector or array.

     FUN: a function; it may be a quoted string.

make.dimnames: Provide dimnames that are the product of the dimnames of
          `X' and `Y'.

     ...: optional arguments to be passed to `FUN'.

_D_e_t_a_i_l_s:

     If `X' and `Y' do not have the same number of dimensions, the
     smaller array is padded with dimensions of size one.  The returned
     array comprises submatrices constructed by taking `X' one term at
     a time and expanding that term as `FUN(x, Y, ...)'.

     `%x%' is an `.Alias' for `kronecker' (where `FUN' is hardwired to
     `"*"').

_A_u_t_h_o_r(_s):

     Jonathan Rougier, J.C.Rougier@durham.ac.uk

_R_e_f_e_r_e_n_c_e_s:

     Matrix Algebra Useful for Statistics, Shayle R. Searle, John Wiley
     and Sons, 1982.

_S_e_e _A_l_s_o:

     `outer', on which `kronecker' is built and `matmult' for usual
     matrix multiplication.

_E_x_a_m_p_l_e_s:

     # simple scalar multiplication
     ( M <- matrix(1:6, ncol=2) )
     stopifnot(kronecker(4, M)==4 * M)
     # Block diagonal matrix:
     stopifnot(kronecker(diag(1, 3), M) == diag(1, 3) %x% M)

     # ask for dimnames

     fred <- matrix(1:12, 3, 4, dimnames=list(LETTERS[1:3], LETTERS[4:7]))
     bill <- c("happy" = 100, "sad" = 1000)
     kronecker(fred, bill, make.dimnames = TRUE)

     bill <- outer(bill, c("cat"=3, "dog"=4))
     kronecker(fred, bill, make.dimnames = TRUE)

