
Last chance! 50% off unlimited learning
Sale ends in
"dsyMatrix"
class is the class of symmetric, dense matrices
in non-packed storage and "dspMatrix"
is the class of symmetric
dense matrices in packed storage. Only the upper triangle or the
lower triangle is stored.new("dsyMatrix", ...)
."dsyMatrix"
extends class "dgeMatrix"
, directly, whereas
"dspMatrix"
extends class "ddenseMatrix"
, directly. Both extend class "symmetricMatrix"
, directly,
and class "Matrix"
and others, indirectly, use
showClass("dsyMatrix")
, e.g., for details.
dgeMatrix
and Matrix
;
solve
, norm
, rcond
,
t
## 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)))
str(t(sy2)) # uplo = "L", and the lower tri. (i.e. NA is replaced).
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))
try(as(sy3, "dpoMatrix")) # -> error: not positive definite
tr <- try(as(sy3, "dpoMatrix"), silent=TRUE)
stopifnot(1 == grep("not a positive definite matrix",
as.character(tr)))
Run the code above in your browser using DataLab