Returns the Cholesky square root of the non-singular, symmetric matrix X
.
The purpose is mainly to demonstrate the algorithm used by Kennedy & Gentle (1980).
Usage
cholesky(X, tol = sqrt(.Machine$double.eps))
Examples
C <- matrix(c(1,2,3,2,5,6,3,6,10), 3, 3) # nonsingular, symmetric
C
#> [,1] [,2] [,3]
#> [1,] 1 2 3
#> [2,] 2 5 6
#> [3,] 3 6 10
cholesky(C)
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 2 1 0
#> [3,] 3 0 1
cholesky(C) %*% t(cholesky(C)) # check
#> [,1] [,2] [,3]
#> [1,] 1 2 3
#> [2,] 2 5 6
#> [3,] 3 6 10