R/arrayMult.R

Defines functions arrayMult

Documented in arrayMult

#' Array multiplication
#' @param centralMat an nxp matrix
#' @param outerMat an nxd matrix
#' @param ncols an integer, the number of columns of outerMat
#'
#' @return an nxpxd matrix, the stacked matrices of centralMat multiplied to every column of outermat
arrayMult = function(centralMat, outerMat, ncols = ncol(outerMat)){
    vapply(seq_len(ncols),
           FUN.VALUE = centralMat, function(x) {
               outerMat[, x] * centralMat
           })
}

Try the combi package in your browser

Any scripts or data that you put into this service are public.

combi documentation built on Nov. 8, 2020, 5:34 p.m.