Learn R Programming

HiPLARM (version 0.1)

chol2inv-methods: Inverse from Cholesky

Description

Invert a symmetric, positive definite square matrix from its Cholesky 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)$.

Usage

"chol2inv"(x, ...)

Arguments

x
a matrix(-like) object; see below.
...
not used here; for compatibility with other methods.

Methods

x = "dtrMatrix"
method for the numeric triangular matrices, built on the MAGMA magma_dpotri and PLASMA PLASMA_dpotri.

References

Martin Maechler, Douglas Bates (Matrix package)

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 DataLab