SparsePointers | R Documentation |
Convert sparse matrix pointers to indices and vice versa
IndexToPointer(j)
PointerToIndex(p)
j |
A vector of sparse matrix colum indices |
p |
A vector of sparse matrix pointers |
IndexToPointer
: A vector of index pointers (p)
PointerToIndex
: A vector of column (j) indices
PointerToIndex
was written by
Josh O'Brien on StackOverflow
PointerToIndex
came from
StackOverflow
dat <- dat <- c(0, 0, 1, 4, 0, 2, 0, 9, 0)
smat <- Matrix::Matrix(data = dat, nrow = 3, sparse = TRUE)
j <- SeuratDisk:::PointerToIndex(p = smat@p)
Matrix::sparseMatrix(i = smat@i + 1, j = j, x = smat@x)
p <- SeuratDisk:::IndexToPointer(j = j)
Matrix::sparseMatrix(i = smat@i + 1, p = p, x= smat@x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.