library(Matrix)
sm <- as(as(Matrix(diag(5) + 1), "dsyMatrix"), "dspMatrix")
chol(sm)
5 x 5 Matrix of class "pCholesky"
[,1] [,2] [,3] [,4] [,5]
[1,] 1.4142136 0.7071068 0.7071068 0.7071068 0.7071068
[2,] . 1.2247449 0.4082483 0.4082483 0.4082483
[3,] . . 1.1547005 0.2886751 0.2886751
[4,] . . . 1.1180340 0.2236068
[5,] . . . . 1.0954451
[1] "SparseM library loaded"
Error in chol(sm) : no applicable method for "chol"
detach("package:SparseM")
chol(sm)
5 x 5 Matrix of class "pCholesky"
[,1] [,2] [,3] [,4] [,5]
[1,] 1.4142136 0.7071068 0.7071068 0.7071068 0.7071068
[2,] . 1.2247449 0.4082483 0.4082483 0.4082483
[3,] . . 1.1547005 0.2886751 0.2886751
[4,] . . . 1.1180340 0.2236068
[5,] . . . . 1.0954451