facmul-methods function

Multiplication by Factors from Matrix Factorizations

Multiplication by Factors from Matrix Factorizations

Multiplies a matrix or vector on the left or right by a factor from a matrix factorization or its transpose.

methods

facmul(x, factor, y, trans = FALSE, left = TRUE, ...)

Arguments

  • x: a MatrixFactorization object.
  • factor: a character string indicating a factor in the factorization represented by x, typically an element of names(expand2(x, ...)).
  • y: a matrix or vector to be multiplied on the left or right by the factor or its transpose.
  • trans: a logical indicating if the transpose of the factor should be used, rather than the factor itself.
  • left: a logical indicating if the y should be multiplied on the left by the factor, rather than on the right.
  • ...: further arguments passed to or from methods.

Returns

The value of op(M) %*% y or y %*% op(M), depending on left, where M is the factor (always without dimnames) and op(M)

is M or t(M), depending on trans.

Details

facmul is experimental and currently no methods are exported from Matrix.

Examples

## Conceptually, methods for 'facmul' _would_ behave as follows ... ## Not run: 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)) }) ## End(Not run)
  • Maintainer: Martin Maechler
  • License: GPL (>= 2) | file LICENCE
  • Last published: 2025-03-11