I am studying compressed row storage (CRS format) for storing an sparse matrix. I can't tell how this works if the matrix has a row with all entries zero, and in particular, what happens with the pointer row_ptr. Could you describe the val, col_ind and row_ptr vectors for the following matrix?

\begin{bmatrix} 2 & 0 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0 \end{bmatrix}

Looking for this, somebody suggested me "if row $i$ contains entirely zeros, you store in row-ptr$(i)$ the same as in row-ptr$(i+1)$" but what happens when the entries of last row are all 0s?


closed as off-topic by Yuval Filmus, David Richerby, vonbrand, user12859, Thomas Klimpel Jan 8 '16 at 0:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development or programming tools are off-topic here, but can be asked on Stack Overflow." – Yuval Filmus, David Richerby, vonbrand, Community, Thomas Klimpel
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ This sounds like a programming question. Perhaps take a look at the source code. $\endgroup$ – Yuval Filmus Jan 7 '16 at 18:48
  • $\begingroup$ More generally, I think that low level questions about file formats are off topic. (Higher level questions could be appropriate.) $\endgroup$ – Yuval Filmus Jan 7 '16 at 23:04
  • $\begingroup$ I'm not sure whether this is off-topic. It looks like it might be a question about a particular data structure for storing sparse matrices, which would presumably be on-topic (?). But I'm not sure, as I'm not familiar with compressed row storage, and I don't know if it's specific to a particular software package or programming framework. $\endgroup$ – D.W. Jan 8 '16 at 0:58

Browse other questions tagged or ask your own question.