2

I am study the format CRS of an sparse matrix. I have a doubt respect to the pointer row_ptr. What happend if the matrix has a row with all entries zero. Could you help to describe the row_ptr vector in the next case

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

juaninf
  • 1,264

1 Answers1

1

The row vector is $$1,2,2,3$$ according to http://www.math.tamu.edu/~srobertp/Courses/Math639_2014_Sp/CRSDescription/CRSStuff.pdf.

Based on the reference, if row $i$ contains entirely zeros, you store in row-ptr($i$) the same as in row-ptr($i+1$).

KittyL
  • 16,965
  • thanks, but what happens if the last row is all zeros? – juaninf Jan 07 '16 at 18:16
  • @juaninf: According to that article, if you replace the last $1$ by $0$, I believe the row vector would be $1,3,3,3$ because whenever row(i+1)-row(i)=0, it indicates row(i) is a zero row. – KittyL Jan 07 '16 at 23:10