# chlsoi.r J F Monahan, June 2008 # # Cholesky factorization and inverse of a positive definite matrix A <- matrix(c(4,2,2,4, 2,5,7,0, 2,7,19,11, 4,0,11,25), 4, 4) "matrix" A Lt <- chol(A) "Cholesky factor -- transposed to be upper triangular" Lt AI <- chol2inv(Lt) "inverse" AI "multiply to get identity" A %*% AI "solve equations" b <-c( -1, 1, 2.5, .25) "Right hand side" b x <- AI %*% b "Solution" x rm(list=ls()) q()