inv_woodbury: Inverse using woodburys matrix identity

View source: R/lin_alg_blockinv.R

inv_woodburyR Documentation

Inverse using woodburys matrix identity

Description

Computes the inverse of (A+UCV) provided that the inverse of A and C exists.

Usage

inv_woodbury(A, U, C, V = t(U), method = "ge", timing = FALSE)

Arguments

A, U, C, V

Either a caracas matrix, or a dense or a sparse matrix.

method

One of the methods that can be supplied to inv().

timing

Should timing be printed

Value

The inverse of (A+UCV)

Author(s)

Søren Højsgaard

Examples

if (has_sympy()) {

n <- 8
m <- 4
A <- diag_("a", n)
U <- round(10*(matrix(rnorm(n*m), nrow=n)))
U[U < 0] <- 0
U <- as_sym(U)
V <- t(U)
C <- diag_("c", m)

B <- A + U %*% C %*% V
B

Bi <- inv_woodbury(A, U, C)
}

r-cas/caracas documentation built on Feb. 28, 2025, 3:39 p.m.