50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

Matrix (version 1.3-0)

chol2inv-methods: Inverse from Choleski or QR Decomposition -- Matrix Methods

Description

Invert a symmetric, positive definite square matrix from its Choleski decomposition. Equivalently, compute (XX)1 from the (R part) of the QR decomposition of X.

Even more generally, given an upper triangular matrix R, compute (RR)1.

Arguments

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.

%% better algorithms are welcome!

See Also

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

Examples

Run this code
# 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