toCsparse {beachmat}R Documentation

Convert a SparseArraySeed to a CsparseMatrix

Description

Exactly what it says in the title.

Usage

toCsparse(x)

Arguments

x

Any object produced by block processing with colBlockApply or rowBlockApply. This can be a matrix, sparse matrix or a two-dimensional SparseArraySeed.

Details

This is intended for use inside functions to be passed to colBlockApply or rowBlockApply. The idea is to pre-process blocks for user-defined functions that don't know how to deal with SparseArraySeed objects, which is often the case for R-defined functions that do not benefit from beachmat's C++ abstraction.

Value

x is returned unless it was a SparseArraySeed, in which case an appropriate CsparseMatrix object is returned instead.

Author(s)

Aaron Lun

Examples

library(DelayedArray)
out <- SparseArraySeed(c(10, 10), 
    nzindex=cbind(1:10, sample(10)),
    nzdata=runif(10))
toCsparse(out)


[Package beachmat version 2.8.1 Index]