Sparse matrix efficient implementation

Hi, I am newbie into this field so the answer might be pretty trivial…

Is the only way to store efficiently a sparse matrix into memory using the values (for elements different than 0), row and column positions ? Is there no way to use a even more efficient implementation ?


Have you had a chance to look at the CUSPARSE library? This is outside my area of expertise, but I think it supports multiple (three?) commonly-used sparse storage formats. Maybe the CUSPARSE documentation even has some recommendations on which storage format is most appropriate for which use case?

Storage of the nonzero values plus row and column indices for each nonzero value is referred to as COO format. From a storage density standpoint, CSR and CSC are slightly more efficient, because they take advantage of additional knowledge about the ordering of the non-zero values in the CSR (or CSC) values vector.

This is covered in the cusparse documentation as well as many other places.

Thanks guys.
I was just wondering whether a Run Length Encoding wouldn’t be more efficient. Then, you would only need to store the non-zero values and the distance (=number of zeros) in between 2 non-zero values.

Run-length encoding works great if access is sequential (e.g. media encoding). Not so great is you need something close to random access for matrix operations. How would one quickly locate element m[i,j] with RLE?

I was thinking of a problem like a matrix multiplication and guessing all values of the matrix where in the memory, the memory was being read serially. I am quite new with these so I will be missing quite a lot…