chol2inv
Invert a Matrix Given its Choleski Decomposition

Description

Computes the inverse of a symmetric, positive definite square matrix from its Choleski decomposition.

Usage

chol2inv(x, size = NCOL(x), LINPACK = FALSE)

Arguments

x an upper triangular matrix regarded as the Choleski decomposition of a symmetric, positive definite matrix.
size the number of initial columns and columns of x to use as the Cholestki decomposition.
LINPACK this argument is ignored.

Details

This function uses the LAPACK library Fortran routine "dpotri" to calculate the inverse of a matrix from its Cholesky decomposition. It avoids the calculation of the intermediate crossprod(x) that can result in singularity problems or loss of precision.
Value
returns the inverse matrix of a the positive definite matrix crossprod(x)[1:size, 1:size].
References
Anderson. E., et al. 1999. LAPACK Users' Guide. Third Edition. Philadelphia, PA: SIAM Publications. Available online at http://www.netlib.org/lapack/lug/lapack_lug.html.
Dongarra, J. J., et al. 1978. LINPACK Users Guide. Pacific Grove, CA: Wadsworth & Brooks/Cole.
See Also
chol
Examples
m <- matrix(1/(1:9)^2, 3, 3)
m[lower.tri(m)] <- 0
chol2inv(m)
solve(crossprod(m))

Package base version 6.1.1-7
Package Index