EricDarve / numerical_linear_algebra

Julia code for the book Numerical Linear Algebra
114 stars 41 forks source link

P. 331: CSR format #180

Closed jsrozner closed 4 years ago

jsrozner commented 4 years ago

On page 331, it's written "size of rowptr is n+1 where n is number of non-zero rows in A"

but imagine a matrix that is 0 everywhere except for row n, col 1. This suggests that the rowptr vector would be only length 2. How would we keep track of all the 0 rows, as well as the final row?

Shouldn't it still be length n+1? (And if we actually had length(nzval), could we get away with just rowval of length n?)

EricDarve commented 4 years ago

That's a weird error. rowptr has length m+1 where m is the number of rows of A.