library(stats, pos = "package:base", verbose = FALSE)
## Conceptually, methods for 'facmul' _would_ behave as follows ...
if (FALSE) {
n <- 3L
x <- lu(Matrix(rnorm(n * n), n, n))
y <- rnorm(n)
L <- unname(expand2(x)[[nm <- "L"]])
stopifnot(exprs = {
all.equal(facmul(x, nm, y, trans = FALSE, left = TRUE), L %*% y)
all.equal(facmul(x, nm, y, trans = FALSE, left = FALSE), y %*% L)
all.equal(facmul(x, nm, y, trans = TRUE, left = TRUE), crossprod(L, y))
all.equal(facmul(x, nm, y, trans = TRUE, left = FALSE), tcrossprod(y, L))
})
}
Run the code above in your browser using DataLab