Sparse Matrices (2019)
matteding.github.io
Sparse Matrices (2019)
1–10 of 21 posts
Re: Sparse Matrices (2019)
#2[1] https://arrow.apache.org/docs/cpp/api/tensor.html?highlight=...
[2] https://github.com/apache/arrow/blob/master/python/pyarrow/t...
Re: Sparse Matrices (2019)
#3Can be a single tree for the matrix where keys are tuples of two integers. Or one tree per row, where keys are single integers, column index.
Unlike CSR, inserting elements is Log(n). RAM overhead is larger than CSR but still reasonable, much smaller than hash maps or red-black trees would be. Similar to CSR, reading rows is mostly sequential RAM reads i.e. pretty fast.
Re: Sparse Matrices (2019)
#4Re: Sparse Matrices (2019)
#5I've gotten the question in ML eng interviews 3 times: implement sparse vector and the respective dot product op. I always go for the handy DOK method.
Re: Sparse Matrices (2019)
#6Re: Sparse Matrices (2019)
#7Re: Sparse Matrices (2019)
#8Another useful representation for them is B+ tree https://en.wikipedia.org/wiki/B%2B_tree Can be a single tree for the matrix where keys are tuples of two integers. Or one tree per row, where keys are single integers, column index. Unlike CSR, inserting elements is Log(n). RAM overhead is larger than CSR but still reasonable, much smaller than hash maps or red-black trees would be. Similar to CSR, reading rows is mos…
Re: Sparse Matrices (2019)
#9No, this is not the mathematical definition. An n-by-n matrix is usually considered sparse if the number of nonzero elements is O(n). Which means that the ratio of nonzero elements goes to zero as the matrix grows.