chol
performs a Cholesky decomposition of
a symmetric positive definite sparse matrix a
of class
matrix.csr
using the block sparse Cholesky algorithm of Ng and
Peyton (1993). The structure of the resulting matrix.csr.chol
object is relatively complicated. If necessary it can be coerced back
to a matrix.csr
object as usual with as.matrix.csr
.
backsolve
does triangular back-fitting to compute
the solutions of a system of linear equations. For systems of linear equations
that only vary on the right-hand-side, the result from chol
can be reused. Contrary to the behavior of backsolve
in base R,
the default behavior of backsolve(C,b)
when C is a matrix.csr.chol
object
is to produce a solution to the system \(Ax = b\) where C <- chol(A)
, see
the example section. When the flag twice
is FALSE
then backsolve
solves the system \(Cx = b\), up to a permutation -- see the comments below.
The command solve
combines chol
and backsolve
, and will
compute the inverse of a matrix if the right-hand-side is missing.
The determinant of the Cholesky factor is returned providing a
means to efficiently compute the determinant of sparse positive
definite symmetric matrices.
There are several integer storage parameters that are set by default in the call
to the Cholesky factorization, these can be overridden in any of the above
functions and will be passed by the usual "dots" mechanism. The necessity
to do this is usually apparent from error messages like: Error
in local(X...) increase tmpmax. For example, one can use,
solve(A,b, tmpmax = 100*nrow(A))
. The current default for tmpmax
is 50*nrow(A)
. Some experimentation may be needed to
select appropriate values, since they are highly problem dependent. See
the code of chol() for further details on the current defaults.