this is not the right ending:

```
>>> doktocsr(SparseMatrix(3,3,[1]+[0]*8))
[[1], [0], [0, 1]]
```

IA should always have length = number of rows + 1

I suspect you should end this as `IA.extend[IA[-1]*(sparse.rows + 1 - len(IA))`