Convert the type of a matrix
Usage
convert_matrix_type(matrix, type = c("uint32_t", "double", "float"))
Examples
mat <- matrix(rnorm(50), nrow = 10, ncol = 5)
rownames(mat) <- paste0("gene", seq_len(10))
colnames(mat) <- paste0("cell", seq_len(5))
mat <- mat %>% as("dgCMatrix") %>% as("IterableMatrix")
mat
#> 10 x 5 IterableMatrix object with class Iterable_dgCMatrix_wrapper
#>
#> Row names: gene1, gene2 ... gene10
#> Col names: cell1, cell2 ... cell5
#>
#> Data type: double
#> Storage order: column major
#>
#> Queued Operations:
#> 1. Load dgCMatrix from memory
convert_matrix_type(mat, "float")
#> 10 x 5 IterableMatrix object with class ConvertMatrixType
#>
#> Row names: gene1, gene2 ... gene10
#> Col names: cell1, cell2 ... cell5
#>
#> Data type: float
#> Storage order: column major
#>
#> Queued Operations:
#> 1. Load dgCMatrix from memory
#> 2. Convert type from double to float