# NOT RUN {
# S is a symmetric positive definite matrix
M<-matrix(rexp(9),3,3); S <- M %*% t(M)
# This should return a zero matrix:
UpperChol(S) %*% t(UpperChol(S)) - S
# This should return a zero matrix too:
t(chol(S)) %*% chol(S) - S
# Unless S is diagonal, in the general case, this will return a
# non-zero matrix:
chol(S) %*% t(chol(S)) - S
# }
Run the code above in your browser using DataLab