as_matrix | R Documentation |
Convert sparse matrix into dense matrix
as_matrix(x, parallel = FALSE, sparse = FALSE)
x |
A matrix. |
parallel |
Logical value, default is |
sparse |
Logical value, default is |
A dense or sparse matrix
m <- simulate_sparse_matrix(
1000, 1000,
decimal = 3
)
system.time(
a <- as.matrix(m)
)
system.time(
b <- as_matrix(m)
)
system.time(
c <- as_matrix(m, parallel = TRUE)
)
system.time(
d <- as_matrix(m, sparse = TRUE)
)
m[1:5, 1:5]
a[1:5, 1:5]
b[1:5, 1:5]
c[1:5, 1:5]
identical(a, b)
identical(a, c)
identical(b, c)
identical(a, d)
identical(b, d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.