Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pd.solve

Inverse of a symmetric positive-definite matrix


Description

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

Usage

pd.solve(x, silent = FALSE, log.det=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 and an error occurs, the function silently returns a NULL value; if silent==FALSE (default), an error generates a stop with an error message.

log.det

a logical value to indicate whether the log-determinant of x is required (default is FALSE).

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.

Value

the inverse matrix of x; if log.det=TRUE, this inverse has an attribute which contains the logarithm of the determinant of x.

Author(s)

Adelchi Azzalini

Examples

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

mnormt

The Multivariate Normal and t Distributions, and Their Truncated Versions

v2.0.2
GPL-2 | GPL-3
Authors
Adelchi Azzalini [aut, cre], Alan Genz [aut] (most Fortran code), Alan Miller [ctb] (Fortran routine PHI), Michael J. Wichura [ctb] (Fortran routine PHINV), G. W. Hill [ctb] (Fortran routine STDINV), Yihong Ge [ctb] (Fortran routines BNVU and MVBVU).
Initial release
2020-08-31

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.