matrix.coo-class | R Documentation |
Class for sparse matrices stored in coordinate aka
“triplet” format, storing for each non-zero entry x[i,j]
the triplet (i,j, x[i,j])
, in slots (ia, ja, ra)
.
Objects can be created by calls of the form new("matrix.coo", ...)
,
but typically rather by as.matrix.coo()
.
ra
:Object of class numeric
, a real array of nnz elements containing the non-zero
elements of A.
ja
:Object of class integer
, an integer array of nnz elements containing the column
indices of the elements stored in ‘ra’.
ia
:Object of class integer
, an integer array of nnz elements containing the row
indices of the elements stored in ‘ra’.
dimension
:Object of class integer
, dimension of the matrix
signature(x = "matrix.coo")
: ...
signature(x = "matrix.coo")
: ...
signature(x = "matrix.coo")
: ...
signature(x = "matrix.coo")
: ...
matrix.csr-class
try( new("matrix.coo") ) # fails currently {FIXME!} # the 1x1 matrix [0]
## correponds to base matrix()
mcoo <- new("matrix.coo", ra=NA_real_, ia = 1L, ja = 1L, dimension = c(1L, 1L))
mcoo # currently *does* print but wrongly: as.matrix.csr(<matrix.coo>) fails to keep NA !!
co2 <- new("matrix.coo", ra = c(-Inf, -2, 3, Inf),
ia = c(1L,1:3), ja = 2L*(1:4), dimension = c(7L, 12L))
co2 # works fine (as has no NA)
## Sparse Diagonal (from "numeric"):
as(1:5, "matrix.diag.csr") # a sparse version of diag(1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.