Last chance! 50% off unlimited learning
Sale ends in
chol(x, ...)
"chol"(x, pivot = FALSE, ...)
x
is not positive definite,
an error is signalled.signature(x = "dgeMatrix")
: works via
"dpoMatrix"
signature(x = "dpoMatrix")
:
Returns (and stores) the Cholesky decomposition of x
, via
LAPACK routines dlacpy
and either magma_dpotrf
or PLASMA_dpotrf
.showMethods(chol, inherited = FALSE) # show different methods
sy2 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, NA,32,77))
(c2 <- chol(sy2))#-> "Cholesky" matrix
stopifnot(all.equal(c2, chol(as(sy2, "dpoMatrix")), tol= 1e-13))
str(c2)
## An example where chol() can't work
(sy3 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, -1, 2, -7)))
try(chol(sy3)) # error, since it is not positive definite
Run the code above in your browser using DataLab