Learn R Programming

mnormt (version 1.4-0)

pd.solve: Inverse of a positive definite matrix

Description

The inverse of a symmetrix positive definite matrix and its log-determinant

Usage

pd.solve(x, silent = FALSE)

Arguments

x
a symmetric positive definite matrix
silent
a logical value which indicates the action to take in case of an error. If silent==TRUE an error produces a silent NULL value of the function; if silent==FALSE (default) an error generates a stop<

Value

  • pd.solve returns the inverse matrix of x, with an attribute "log.det" representing the logarithm of the determinant of x

Details

The function checks that x is a symmetric positive definite matrix. If an error is detected, an action is taken which depends on the value of the argument silent.

Examples

Run this code
x <- toeplitz(rev(1:4))
  x.inv <- pd.solve(x)
  print(x.inv %*% x)
  logDet <- attr(x.inv, "log.det")
  print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))

Run the code above in your browser using DataLab