inv: Calculate the inverse of a matrix

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/inv.R

Description

Calculates the inverse of a symmetric positive definite matrix from its Cholesky composition.

Usage

1
inv(a)

Arguments

a

a symmetric positive definite matrix

Details

This is an interface to the LAPACK routine DPOTRI implemented in the function chol2inv. The function calculates cholesky decomposition of the given matrix and inputs this into chol2inv.

Value

The inverse of the given matrix.

Author(s)

Thomas Kvalnes

References

Anderson. E. et al. 1999. LAPACK Users' Guide. Third Edition. SIAM [Available online at: http://www.netlib.org/lapack/lug/lapack_lug.html].

See Also

chol, chol2inv

Examples

1
2
3
4
5
6
#Example matrix
mat <- matrix(c(1, 0.5, -3, 0.5, 3, 0.5, -3, 0.5, 12), ncol = 3)
#Show that it is positive definite
eigen(mat)$values
#Calculate inverse
inv(mat)

lmf documentation built on May 30, 2017, 1:44 a.m.