I'm looking for simple sparse vector implementation that can be mapped into memory, similarly to numpy.memmap
.
Unfortunately, numpy
implementation deals only with full vector. Example usage:
vec = SparseVector('/tmp/file.dat') # SparseVector is the class I'm looking for
vec[10] = 10
vec[50] = 21
for key in vec:
print vec[key] # 10, 21
I foung scipy
class representing sparse matrix, however 2 dimensions are clumsy to use as I'd need to make matrix with only one row a then use vec[0,i]
.
Any suggestions?