Function to convert a Sparse matrix to CSR format


Is there a function to convert a sparse matrix to CSR format in CUDA?


cusparse has various sparse matrix conversion functions. However your request is unclear, because when we use the term “sparse matrix” we are sometimes referring to a matrix that is represented in a sparse storage format (e.g. CSR, CSC, ELL, HYB, etc.)

If you mean conversion of a dense matrix that has a lot of zeroes in it into a sparse-storage-format, there are some conversion functions of that type in cusparse library also:

Thank you for your response. I am trying to convert a dense matrix with lots of zeros into csr format.
Also, I have come across the parameter int lda, which is the leading dimension of the matrix.

Is lda equal to the number of rows of a matrix?