chol2inv-methods {Matrix} | R Documentation |
Invert a symmetric, positive definite square matrix from its Choleski
decomposition. Equivalently, compute (X'X)^{-1}
from the (R
part) of the QR decomposition of X
.
Even more generally, given an upper triangular matrix R
,
compute (R'R)^{-1}
.
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
.
(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)