Inverts a symmetric positive-definite matrix without requiring the Matrix package.

sinv(obj)

Arguments

obj

The symmetric positive-definite matrix

Value

A matrix of the same size as the input object

Details

This function does no error checking and it is up to the user to ensure that the input is indeed symmetric, positive-definite, and a matrix.

Examples

m <- matrix(c(1, 0, .5, .5, 0, 1, .5, .5, .5, .5, 1, .5, .5, .5, .5, 1), 4) sinv(m)
#> [,1] [,2] [,3] [,4] #> [1,] 2 1 -1 -1 #> [2,] 1 2 -1 -1 #> [3,] -1 -1 2 0 #> [4,] -1 -1 0 2