I’m finding that to unit test my opencl code with c++ catch, I need large arrays, or tensors, that are mostly unfilled. I could use dense vectors, but I want to use sparse maps since I’ll eventually be using something like that in opencl for efficiency.
I wrote a small sparse tensor class, but it’s complaining about not having a hash function, so I have to implement that. Also since I’m trying to work with different sizes to mimic the entorhinal cortex (e.g., for my image input, I could have {{800,600}, {400,300}, …}), I need to add a function for dealing with tensors with different sizes of arrays.
Before I get too deep into things though, I thought I’d ask if anyone has worked a lot on building sparse arrays, or at least thought about it. If so, what are some tips for creating sparse arrays on the computer? Any problems you’ve run into? Also, how does my code stack up so far?
Code: https://gist.github.com/SimLeek/808266d917af8d22e54dbe829eb5f876
(SparseTensor is at line 38. Test code is in a comment.)