extract_sparse_parts: Extract the compressed representation of a sparse matrix
Description
Create a list of vectors that represents a sparse matrix
Usage
extract_sparse_parts(A)
Arguments
A
A matrix or Matrix
Value
A named list with components
wA numeric vector containing the non-zero elements ofA
vAn integer vector containing the column indices of the non-zero
elements ofA
uAn integer vector indicating where inwa given row's
non-zero values start
Details
The Stan Math Library has a function called csr_matrix_times_vector,
which inputs a matrix in compressed row storage form and a dense vector and
returns their product without fillin. To utilize this function with a large
sparse matrix, it is optimal in terms of memory to simply pass the three vectors
that characterize the compressed row storage form to the data block
of the Stan program.