| CsparseMatrix-class {Matrix} | R Documentation |
The "CsparseMatrix" class is the virtual class of
all sparse matrices coded in sorted compressed column-oriented form.
Since it is a virtual class, no objects may be created from it. See
showClass("CsparseMatrix") for its subclasses.
i:"integer" of length nnzero
(number of non-zero elements). These are the 0-based row numbers for
each non-zero element in the matrix, i.e., i must be in
0:(nrow(.)-1)p:"integer" for providing pointers, one
for each column, to the initial (zero-based) index of elements in
the column. .@p is of length ncol(.) + 1, with
p[1] == 0 and p[length(p)] == nnzero, such that in
fact, diff(.@p + 1) are the number of non-zero elements for
each column.factors, Dim, Dimnames:sparseMatrix class.
Class "sparseMatrix", directly.
Class "Matrix", by class "sparseMatrix".
signature(e1 = "CsparseMatrix", e2 = "numeric"): ... signature(e1 = "numeric", e2 = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(e1 = "CsparseMatrix", e2 = "numeric"): ... signature(e1 = "numeric", e2 = "CsparseMatrix"): ... signature(x = "CsparseMatrix", i = "index", j = "missing", value = "replValue"): ... signature(x = "CsparseMatrix", i = "index", j = "index", value = "replValue"): ... signature(x = "CsparseMatrix", i = "missing", j = "index", value = "replValue"): ... signature(x = "CsparseMatrix", y = "CsparseMatrix"): ... signature(x = "CsparseMatrix", y = "denseMatrix"): ... signature(x = "CsparseMatrix", y = "matrix"): ... signature(e1 = "CsparseMatrix", e2 = "numeric"): ... signature(e1 = "numeric", e2 = "CsparseMatrix"): ... signature(from = "CsparseMatrix", to = "TsparseMatrix"): ... signature(from = "CsparseMatrix", to = "denseMatrix"): ... signature(from = "CsparseMatrix", to = "matrix"): ... signature(from = "CsparseMatrix", to = "lsparseMatrix"): ... signature(from = "CsparseMatrix", to = "nsparseMatrix"): ... signature(from = "TsparseMatrix", to = "CsparseMatrix"): ... signature(from = "denseMatrix", to = "CsparseMatrix"): ... signature(x = "CsparseMatrix", y = "CsparseMatrix"): ... signature(x = "CsparseMatrix", y = "missing"): ... signature(x = "CsparseMatrix", y = "dgeMatrix"): ... signature(x = "CsparseMatrix", y = "matrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix", y = "CsparseMatrix"): ... signature(x = "CsparseMatrix", y = "missing"): ... signature(x = "CsparseMatrix"): ... signature(x = "CsparseMatrix"): ...
All classes extending CsparseMatrix have a common validity
(see validObject) check function. The function
additionally checks and if necessary sorts the entries in
each row into increasing row numbers. This allows to use
new() calls with somewhat permuted i and x
slots, as new(...) (with slot arguments)
automatically checks the validity, see the example.
colSums, kronecker, and other such methods
with own help pages.
Further, the super class of CsparseMatrix,
sparseMatrix, and, e.g.,
class dgCMatrix for the links to other classes.
getClass("CsparseMatrix")
## The common validity check function (based on C code):
getValidity(getClass("CsparseMatrix"))
# un-sorted i-slot on input is automatically "sorted" :
M <- new("dgCMatrix", Dim = 2:3, p = as.integer(c(0,1,1,3)),
i = c(1L, 1:0), x= c(2,2,1))
stopifnot(M@i == c(1L, 0:1), M@x == c(2,1,2))