Viral B. Shah discussed (in 2015!) why CSR matrixes were not included in Sparse Arrays: link. The justification makes sense, but I now find myself wishing there was an easy way to access CSR sparse array. I just want to get stuff done, and I don’t care much about the elegance of the abstraction design at the current time.
Does anyone have suggestions for an easy work-around so that I can use a CSR matrix? A few “solutions” I’ve considered:
Bite the bullet and implement a CSR matrix from the ground up. This feels like a waste of time because Viral mentions that someone has already done this – it just wasn’t included in Sparse Arrays. (Does anyone know where I can find this implementation?)
Hack together a CSR matrix that is simply an interface to a CSC matrix. This might take less time to implement than option 1, and it might require less debugging. Again, this feels like a waste of time and coding effort.
Use a 3rd party project that hasn’t been touched since 201(whatever). A quick search on github or google will reveal a few potential candidates. This seems risky since most of the projects I’ve seen do not have testing, documentation, or a broad user base.
I ran some benchmarks using the suggestions of @rdeits and @Oscar_Smith . The example matrix is the 2D finite-difference laplacian on a grid of 10,000 x 10,000 points. The “CSR” matrix is the transpose of the CSC matrix. Below are the benchmark results and a conclusion. All times are the minimum benchmark time: