SparseVector has list semantics, docs imply numpy.array semantics
Opened this issue · 1 comments
jfine2358 commented
The source file says
A "sparse vector" is basically a 1D
numpy.ndarray
I read this to imply that the semantics for +
and *
are those of a numpy.array
. However, the semantics seem to be those of a list
.
By the way, for my application I want numpy.array semantics.
>>> from numpy import array as na
>>> from sparse_vector import SparseVector as sv
>>> na(range(3)) + 2
array([2, 3, 4])
>>> sv(range(3)) + 2
Traceback (most recent call last):
TypeError: 'int' object is not iterable
>>> na(range(3)) * 2
array([0, 2, 4])
>>> sv(range(3)) * 2
[0.0, 1.0, 2.0, 0.0, 1.0, 2.0]
Goutte commented
You're correct !
But this lib has not achieved the efficiency it requires to be pertinent, so I'm archiving it.
Thanks for the issue, and sorry for not responding sooner (did not see).