## Only upper triangular part matters (when uplo == "U" as per default)
(sy2 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, NA,32,77)))
chol(sy2) #-> "Cholesky" matrix
## Coercing to dpoMatrix gives invalid object:
sy3 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, -1, 2, -7))
validObject(as(sy3, "dpoMatrix"), test=TRUE) #... not positive definite
stopifnot(identical("dpoMatrix is not positive definite",
validObject(as(sy3, "dpoMatrix"), test=TRUE)))
Run the code above in your browser using DataLab