
Last chance! 50% off unlimited learning
Sale ends in
dsCMatrix
class is a class of symmetric, sparse
numeric matrices in the compressed, column-oriented format. In this
implementation the non-zero elements in the columns are sorted into
increasing row order.
The dsTMatrix
class is the class of
symmetric, sparse numeric matrices in triplet format.new("dsCMatrix",
...)
or new("dsTMatrix", ...)
or (for dsCMatrix
) also
automatically from Matrix(.)
.symmetricMatrix
dsparseMatrix
directly;
dsCMatrix
further directly extends
CsparseMatrix
, where
dsTMatrix
does TsparseMatrix
.dgCMatrix
, dgTMatrix
,
dgeMatrix
and those mentioned above.mm <- Matrix(toeplitz(c(10, 0, 1, 0, 3)), sparse = TRUE)
mm # automatically dsCMatrix
str(mm)
## how would we go from a manually constructed Tsparse* :
mT <- as(mm, "dgTMatrix")
## Either
(symM <- as(mT, "symmetricMatrix"))# dsT
(symC <- as(symM, "CsparseMatrix"))# dsC
## or
sC <- Matrix(mT, sparse=TRUE, forceCheck=TRUE)
sym2 <- as(symC, "TsparseMatrix")
stopifnot(identical(symC, sC), identical(sym2, symM),
class(sym2) == "dsTMatrix",
identical(sym2[1,], sC[1,]),
identical(sym2[,2], sC[,2]))
Run the code above in your browser using DataLab