trying to resist writing one, a few qs.. #282
Replies: 3 comments 2 replies
-
Q1: There is currently a multi-threaded matrix-matrix product computation in this crate, but no matrix-vector computations (PRs welcome!). In the Q2: We have the |
Beta Was this translation helpful? Give feedback.
-
thanks for the reply. a type with a layout optimized for one task , wouldn't need all the impls, but conversion to and from other types would allow easily slotting it in almost like using the "general purpose version" as a builder for the parallel-gather version. it seems you have the TriMat version as a builder. (Just a comment , I find that name a bit unintuitive - I first guessed that it's a triangular matrix , which is something else that has reason to exist in matrix libraries. I'm not sure if you can rename it without irritating existing users ..thats a breaking change for sure.. |
Beta Was this translation helpful? Give feedback.
-
Something else on my mind is how to implement a sparse matrix of 1 or 0 I'm trying to think how this would work in terms of the type system with conversions, e.g. SparseVec -> DenseVec does it need an explicit "sparse to dense with type conversion" to handle this sanely. Does it break anything if the T can't represent itself in dense format? allowing this would save replicating all the COO -> CSR/CSC logic for an explicit "SparseBinaryVec, SparseBinaryMatrix" ? |
Beta Was this translation helpful? Give feedback.
-
so I was about to try and write an sparse neural net ,structuring it with sparse vector / matrix operations, and in turn was about to write some helper code exactly like this. I have some questions
Q1 - does this have parallel implementations yet ? If not has it been considered, is there a roadmap?
seems there are a few ways to implement parallel sparse matrix multiply eg. avoiding locks for each accumulation
my use case is a static (or slow changing) matrix, with fast changing vectors. so having a precalculated index table in the matrix to accelerate 'a gather' approach to the accumulation might be worthwhile ( generate temporary of products, then gather those results)
.. but there's probably many ways to actually do this, all with different memeory-speed / dynamic-fixed tradeoffs
and actually the design I have in my head started as a "Parallel graph update" , which is why I have the picture of a vector of "edges" (==non-zero matrxi elems) and a "node-gather-from-edges index list" to accelerate parallel accumulation
I figured the "ParallelUpdatableGraph<Node,Edge>" type I had in mind could be created as a SparseVector , SparseMatrix, with "messages along edges" being a Node*Edge->Temp, and "acumulation of messages" being (Temp+Temp), and actual node update being some kind of "Node+=Temp, filter the result to re-sparsify"
Q2 would you consider adding constructors/accessors in the (i,j,T) format eg new_from_indexed_elems(vec![((i,j),T),((i1,j1),T1) ...]) or perhaps a "collect" , similarly that for the sparse vector vec![(index0,value0), (index1,value1) ...]
I've still got a strong NIH urge here, perhaps I should just go ahead and write a seperate lib that behaves the way i describe, and just try to make similar interfaces such that these two things could be interchanged
Beta Was this translation helpful? Give feedback.
All reactions