Computes a rank-\(k\) update or downdate of a sparse Cholesky factorization $$P_{1} A P_{1}' = L_{1} D L_{1}' = L L'$$ which for some \(k\)-column matrix \(C\) is the factorization $$P_{1} (A + s C C') P_{1}' = \tilde{L}_{1} \tilde{D} \tilde{L}_{1}' = \tilde{L} \tilde{L}'$$ Here, \(s = 1\) for an update and \(s = -1\) for a downdate.

updown(update, C, L)

Arguments

update

a logical (TRUE or FALSE) or character ("+" or "-") indicating if L should be updated (or otherwise downdated).

C

a finite matrix or Matrix such that tcrossprod(C) has the dimensions of L.

L

an object of class dCHMsimpl or dCHMsuper specifying a sparse Cholesky factorization.

Value

A sparse Cholesky factorization with dimensions matching L, typically of class dCHMsimpl.

See also

Classes dCHMsimpl and dCHMsuper and their methods, notably for generic function update, which is not equivalent to updown(update = TRUE).

Generic function Cholesky.

Author

Initial implementation by Nicholas Nagle, University of Tennessee.

References

Davis, T. A., Hager, W. W. (2001). Multiple-rank modifications of a sparse Cholesky factorization. SIAM Journal on Matrix Analysis and Applications, 22(4), 997-1013. doi:10.1137/S0895479899357346

Examples

m <- sparseMatrix(i = c(3, 1, 3:2, 2:1), p = c(0:2, 4, 4, 6), x = 1:6,
                  dimnames = list(LETTERS[1:3], letters[1:5]))
uc0 <- Cholesky(A <- crossprod(m) + Diagonal(5))
uc1 <- updown("+", Diagonal(5, 1), uc0)
uc2 <- updown("-", Diagonal(5, 1), uc1)
stopifnot(all.equal(uc0, uc2))