I'm dealing a lot with large sparse linear operators these days and I'm quite new to them. A lot of the matrices I deal with originate with only a few unique integers, however, there are lots of them. As a result I have tons of memory locked up for the same values and fetching them from RAM seems like quite the bottle neck. It seems like a well designed for loop could replace these matrices for matrix multiplication, but writing custom loops for that seems like a chore. Are there tools or techniques to do this?

  • $\begingroup$ Are you able to know a priori the sets of nonzeros that have the same value? If so, you could just compute the sparsity pattern for each value and omit storing the value (except in a single side variable). You'd be able to keep the value in a register and not fetch it from memory as you do your usual sparse operations on the sparsity pattern. $\endgroup$ – Tyler Olsen Mar 25 '17 at 1:18
  • $\begingroup$ I do know some of the sparsity patterns. For those I was think of creating an object with single values as you suggest and maybe iterators for the sparsity pattern. I'm really hoping for more general transformations where the sparsity patterns aren't necessarily known and perhaps the result of these matrix operations. I've seen some papers on what I'm looking for, but most seem to be focused on GPU programming, which makes sense. $\endgroup$ – bfletch Mar 25 '17 at 4:44
  • $\begingroup$ How are you storing those sparse matrices right now? CSR, CRS? Are you using any sparse (or general) matrix library to perform your matrix operations? $\endgroup$ – Anton Menshov Apr 16 '17 at 5:16
  • $\begingroup$ The code is currently in Julia which means the matrices are in CSC format and SuiteSparse is used for operations. I'm entirely flexible on all of this though. $\endgroup$ – bfletch Apr 17 '17 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.