Invert a symmetric, positive definite square matrix from its Choleski
decomposition. Equivalently, compute
Even more generally, given an upper triangular matrix
the default method from base, see
chol2inv
, for traditional matrices.
method for the numeric triangular matrices,
built on the same LAPACK DPOTRI
function as the base
method.
if x
is coercable to a
'>triangularMatrix
, call the "dtrMatrix"
method above.
if x
is coercable to a
'>triangularMatrix
, use solve()
currently.
chol
(for '>Matrix
objects);
further, chol2inv
(from the base package),
solve
.
# NOT RUN {
(M <- Matrix(cbind(1, 1:3, c(1,3,7))))
(cM <- chol(M)) # a "Cholesky" object, inheriting from "dtrMatrix"
chol2inv(cM) %*% M # the identity
stopifnot(all(chol2inv(cM) %*% M - Diagonal(nrow(M))) < 1e-10)
# }
Run the code above in your browser using DataLab