scipy: sparse/dense matrix multiplication error
Sparse matrix time dense one is fine. Dense matrix time sparse one cause infinite memory consumption.
Reproducing code example:
# Full example.
import numpy
import scipy
import scipy.sparse
import scipy.sparse.linalg
N = 1000
H = scipy.sparse.eye(N)
P = numpy.random.rand(N,N)
HP = H.dot(P) # fine
PHt = P.dot(H.transpose()) # error: takes memory until computer is dead
Error message:
Ubuntu 16.04/64 No message, computer just hangs up after a while running out of memory
Scipy/Numpy/Python version information:
Ubuntu 16.04/64 Python 3.6.1 (compiled from sources) numpy 1.12.1 scipy 0.19.0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (14 by maintainers)
Commits related to this issue
- MAINT: `__array__` and array protocols cannot be used in sparse. Document so this is easy to find back for anyone interested in it. xref gh-7349, gh-7707, gh-10362 [ci skip] — committed to rgommers/scipy by rgommers 4 years ago
- MAINT: `__array__` and array protocols cannot be used in sparse. (#12279) Document so this is easy to find back for anyone interested in it. xref gh-7349, gh-7707, gh-10362 [ci skip] — committed to scipy/scipy by rgommers 4 years ago
Good questions. @pv - did I remember wrong the real trouble for implementing
spmatrix.__array_ufunc__
?