[SciPy-User] Alternative for scipy.sparse.sparsetools for use from outside of scipy

Pauli Virtanen pav at iki.fi
Tue Oct 6 15:28:58 EDT 2015


Lev Konstantinovskiy <lev.konst <at> gmail.com> writes:
> Getting deprecation warning for sparsetools. Is there an alternative to 
> switch to?
> 
> The use is sparsetools.csc_matvecs in gensim 
> https://github.com/piskvorky/gensim/blob/9a1c2c954e2f72213023fc01f0e33306001e
> 303f/gensim/models/lsimodel.py

If I understand correctly, these are use cases that can be expressed
in terms of usual sparse matrix operations,

y = corpus * o
y += corpus * chunk

but you are using the internal sparsetools routines instead,
because of performance reasons? Is the performance difference
big in this case? Is the issue that you want in-place sparse AXPY,
or is it due to dealing with small matrices and avoiding
overheads?

There's currently no sparse axpy available in Scipy.
There probably should be though.

Gensim is not a pure-Python module, so one relatively straightforward
possibility is to just bundle a copy of the current sparsetools
module (or just the one routine you need) with it. There's no SWIG
nowadays involved, and it's independent of the rest of Scipy,
so it's probably doable.

-- 
Pauli Virtanen




More information about the SciPy-User mailing list