chol2inv-methods {Matrix}R Documentation

Inverse from Choleski or QR Decomposition – Matrix Methods

Description

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).

Methods

x = "ANY"

the default method from base, see chol2inv, for traditional matrices.

x = "dtrMatrix"

method for the numeric triangular matrices, built on the same LAPACK DPOTRI function as the base method.

x = "denseMatrix"

if x is coercable to a triangularMatrix, call the "dtrMatrix" method above.

x = "sparseMatrix"

if x is coercable to a triangularMatrix, use solve() currently.

See Also

chol (for Matrix objects); further, chol2inv (from the base package), solve.

Examples

(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)

[Package Matrix version 1.0-6 Index]