PCMBase (version 1.2.10)

UpperChol: Upper triangular factor of a symmetric positive definite matrix

Description

This function is an analog to the Cholesky decomposition.

Usage

UpperChol(Sigma)

Arguments

Sigma

A symmetric positive definite k x k matrix that can be passed as argument to chol.

Value

an upper triangular matrix Sigma_x, such that Sigma = Sigma_x

See Also

chol

Examples

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