pdsInverse: Inverse of a positive definite symmetric matrix

Description Usage Arguments Value Examples

View source: R/Bayesian_Bricks.r

Description

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

Usage

1
pdsInverse(S, returnUpper = FALSE)

Arguments

S

a symmetric positive definitive matrix.

returnUpper

logical, return inv(A) if returnUpper=TRUE,return inv(S) if returnUpper=FALSE, default FALSE.

Value

A matrix, the inverse of "S".

Examples

1
2
3
Sigma = matrix(c(2,1,1,2),2,2)      # some positive definite symmetric matrix
pdsInverse(Sigma)                   # 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.