UpperTriFactor: Upper triangular factor of a symmetric positive definite...

View source: R/matrixparametrizations.R

UpperTriFactorR Documentation

Upper triangular factor of a symmetric positive definite matrix

Description

This function is an analog to the Cholesky decomposition.

Usage

UpperTriFactor(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 %*% t(Sigma_x)

See Also

chol;

the option PCMBase.Transpose.Sigma_x in PCMOptions.

Examples

# S is a symmetric positive definite matrix
M<-matrix(rexp(9),3,3); S <- M %*% t(M)

# This should return a zero matrix:
UpperTriFactor(S) %*% t(UpperTriFactor(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

venelin/PCMBase documentation built on March 14, 2024, 8:24 p.m.