#' Column wise kronecker product #' #' This is a special case of the "Khatri-Rao Product". #' #' @seealso \link{\code{rowKronecker}} #' #' @export colKronecker <- function(A, B) { sapply(1:ncol(A), function(i) kronecker(A[, i], B[, i])) } #' Row wise kronecker product #' #' Also known as the "Face-splitting product". This is a special case of the #' "Khatri-Rao Product". #' #' @seealso \link{\code{colKronecker}} #' #' @export rowKronecker <- function(A, B) { C <- vapply(seq_len(ncol(A)), function(i) A[, i] * B, B) dim(C) <- c(nrow(A), ncol(A) * ncol(B)) C }