SparseVector is an n-dimension sparse vector.
Very simple implementation with just the functions I needed at the time for Lunrelm.
Model stored in Dict with index as key.
Dimension of vector is not held, so there is no way to check that dot or cosineSimilarity are both using the same dimension vector.
Empty SparseVector
Return true if vector is empty
Insert value in vector.
Insert list of values in vector.
Calculates magnitude of vector.
Sqrt of Sum of Squares of each dimension value.
Calculates the dot product between vectors.
Calculates the cosine similarity between vectors.
Copyright (c) 2016 Robin Luiten
SparseVector type alias