Rank 1 update to Cholesky factorization in R

Rank 1 update can be achieved in Matlab with the built-in function cholupdate(). More details about the function can be found here:


In R, the recommended Matrix package has added a function updown() to handle rank 1 update. However, the documentation of that function is not easy to understand, and I find the example given is misleading. That prompted me to replicate the Matlab example with the updown() function. The resulting code snippet is shown below.

A <- symmetric.pascal.matrix(4)
R <- chol(A)

x <- c(0, 0, 0, 1)

A + x%*%t(x)

R <- Cholesky(Matrix(A, sparse=T))
x <- Matrix(x)
R1.sparse <- updown('+', x, R)
R1 <- as(R1.sparse, 'Matrix')

x <- Matrix(c(0, 0, 0, 1/sqrt(2)))
R1.sparse <- updown('-', x, R)
R1 <- as(R1.sparse, 'Matrix')

Note that matrices have to be in the sparse representation to be used in the updown() function.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: