cholsolve: Solve the equation Qx = y

Description Usage Arguments Value References Examples

Description

This function is similar to solve(Q,y) but with the added benefit that it allows for permuted matrices. This function does the job in order to minimise user error when attempting to re-permute the matrices prior or after solving. The user also has an option for the permuted Cholesky factorisation of Q to be carried out internally.

Usage

1
2
cholsolve(Q = NULL, y = NULL, perm = FALSE, cholQ = NULL,
  cholQp = NULL, P = NULL)

Arguments

Q

matrix (if of class Matrix needs to be column-compressed, i.e., dgCMatrix or dsCMatrix)), the Cholesky factor of which needs to be found

y

matrix with the same number of rows as Q

perm

if FLASE no permutation is carried out, if TRUE permuted Cholesky factors are used

cholQ

the lower Cholesky factor of Q (if known already)

cholQp

the lower Cholesky factor of a permuted Q (if known already)

P

the permutation matrix (if known already)

Value

x solution to Qx = y

References

Havard Rue and Leonhard Held (2005). Gaussian Markov Random Fields: Theory and Applications. Chapman & Hall/CRC Press

Examples

1
2
3
4
5
6
require(Matrix)
Q = sparseMatrix(i = c(1, 1, 2, 2),
                 j = c(1, 2, 1, 2),
                 x = c(0.1, 0.2, 0.2, 1))
y = matrix(c(1, 2), 2, 1)
cholsolve(Q, y)

sparseinv documentation built on May 2, 2019, 7:04 a.m.