Matrix (version 1.2-7.1)

chol2inv-methods: 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)$.

Arguments

Methods

See Also

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

Examples

Run this code
(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 DataCamp Workspace