pdsDeterminant: determinant of a positive definite symmetric matrix

Description Usage Arguments Value Examples

View source: R/Bayesian_Bricks.r

Description

Use Cholesky decomposition to calculate the determinant of S, where S = A'A, A is a upper diagonal matrix. det(S) = det(A)*det(A).

Usage

1

Arguments

S

a symmetric positive definitive matrix.

LOG

logical, return log(det(S)) if TRUE, return det(S) if FALSE, default FALSE.

Value

A matrix, the determinant of "S".

Examples

1
2
3
4
Sigma = matrix(c(1.3,1,1,2),2,2)      # some positive definite symmetric matrix
pdsDeterminant(Sigma)                 # get inv(Sigma)
pdsDeterminant(Sigma,LOG=TRUE)        # get inv(Sigma)
pdsInverse(Sigma,returnUpper=TRUE)  # get inv(A), where Sigma=A'A, A is upper triangle

bbricks documentation built on July 8, 2020, 7:29 p.m.