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

Most upvoted comments

Good questions. @pv - did I remember wrong the real trouble for implementing spmatrix.__array_ufunc__?