Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How much faster is multiplication using a sparse matrix library than normal multiplication over a hash table?”

0
10 Posted

How much faster is multiplication using a sparse matrix library than normal multiplication over a hash table?”

0
10

A sparse matrix library is going to store the elements of the matrix in the natural order, so that elements in the same row are close to each other. Your current hash algorithm (by definition) scatters the elements of your matrix randomly throughout the buckets. When writing matrix algorithms, the cache hit rate is King in determining performance, and a hash table has very bad locality of reference. Using a hash table gets you quick and easy random access to the elements, but you don’t need that to do multiplication. Matrix multiplication is a very structured operation that lends itself to sequential rather than random access. A packed format may cost you a little in element access time, but it should work fine for multiplication. Plus it cuts down on memory size, which is the whole reason to use a sparse format in the first place. The other thing to consider is that sparselib is going to be optimized for matrix math, and the only people that care about sparse matricies are those using

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123