Description Usage Arguments Value Examples
View source: R/matrix_functions.R
Converts compressed sparse row format to compressed sparse column format and vice versa. The unerlying matrix is the same; this function simply reorganizes the data to allow for easier column/row access.
1 2 3 4 5 6 7 8 | flip_compressed_matrix(
x,
row_idx,
col_ptr,
n_col,
n_row,
zero_based_idx = TRUE
)
|
x |
the vector of data |
row_idx |
the vector of row indexes |
col_ptr |
the column pointer |
n_col |
number of columns |
n_row |
number of rows |
zero_based_idx |
(boolean; default TRUE) does the input matrix use zero-based indexing? |
the transposed matrix; specifically, a list with the elements p, i, x, dim, and zero_based_idx.
1 2 3 4 5 6 7 8 | A <- create_example_sparse_matrix(10, 5)
A_csc <- get_compressed_matrix_representation(A, "column")
x <- A_csc$x
row_idx <- A_csc$i # row index
col_ptr <- A_csc$p # column pointer
n_col <- A_csc$dim[2]
n_row <- A_csc$dim[1]
flip_compressed_matrix(x, row_idx, col_ptr, n_col, n_row)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.