(A <- Matrix(cbind(c(1, 1, 1), c(1, 2, 4), c(1, 4, 16))))
(R <- chol(A))
(L <- t(R))
(R2i <- chol2inv(R))
(L2i <- chol2inv(R))
stopifnot(exprs = {
all.equal(R2i, tcrossprod(solve(R)))
all.equal(L2i, crossprod(solve(L)))
all.equal(as(R2i %*% A, "matrix"), diag(3L)) # the identity
all.equal(as(L2i %*% A, "matrix"), diag(3L)) # ditto
})
Run the code above in your browser using DataLab