R/mathutils.R

Defines functions list_extract row_multiply_list_mats

Documented in row_multiply_list_mats

##' @title Multiply a row by a list of matrices
##' @param r Row vector.
##' @param mats 
##' @return List of row by matrix products.
##' @author Stephen R Martin
##' @keywords internal
row_multiply_list_mats <- function(r, mats) {
    r <- matrix(r, nrow = 1)
    lapply(mats, function(m) {
        r %*% m
    })
}

list_extract <- function(l, what) {
    lapply(l, function(l) {
        l[[what]]
    })
}

Try the LMMELSM package in your browser

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

LMMELSM documentation built on Dec. 28, 2022, 1:32 a.m.