Learn R Programming

Matrix (version 1.5-1)

updown: Up- and Down-Dating a Cholesky Decomposition

Description

Compute the up- or down-dated Cholesky decomposition

Usage

updown(update, C, L)

Value

an updated Cholesky factor, of the same dimension as L. Typically of class "dCHMsimpl" (a sub class of

"CHMfactor").

Arguments

update

logical (TRUE or FALSE) or "+" or "-" indicating if an up- or a down-date is to be computed.

C

any R object, coercable to a sparse matrix (i.e., of subclass of sparseMatrix).

L

a Cholesky factor, specifically, of class "CHMfactor".

Author

Contributed by Nicholas Nagle, University of Tennessee, Knoxville, USA

Methods

signature(update = "character", C = "mMatrix", L = "CHMfactor")

..

signature(update = "logical", C = "mMatrix", L = "CHMfactor")

..

References

CHOLMOD manual, currently beginning of chapter~18. ...

See Also

Cholesky,

Examples

Run this code
dn <- list(LETTERS[1:3], letters[1:5])
## pointer vectors can be used, and the (i,x) slots are sorted if necessary:
m <- sparseMatrix(i = c(3,1, 3:2, 2:1), p= c(0:2, 4,4,6), x = 1:6, dimnames = dn)
cA <- Cholesky(A <- crossprod(m) + Diagonal(5))
166 * as(cA,"Matrix") ^ 2
uc1 <- updown("+",   Diagonal(5), cA)
## Hmm: this loses positive definiteness:
uc2 <- updown("-", 2*Diagonal(5), cA)
image(show(as(cA, "Matrix")))
image(show(c2 <- as(uc2,"Matrix")))# severely negative entries
##--> Warning

Run the code above in your browser using DataLab