我试图取两个 lil_matrix 稀疏矩阵的点积。分别为 100,000 x 50,000 和 50,000 x 100,000。
from scipy import sparse
a = sparse.lil_matrix((100000, 50000))
b = sparse.lil_matrix((50000, 100000))
c = a.dot(b)
并收到此错误:
File "/usr/lib64/python2.6/site-packages/scipy/sparse/base.py", line 211, in dot
return self * other
File "/usr/lib64/python2.6/site-packages/scipy/sparse/base.py", line 247, in __mul__
return self._mul_sparse_matrix(other)
File "/usr/lib64/python2.6/site-packages/scipy/sparse/base.py", line 300, in _mul_sparse_matrix
return self.tocsr()._mul_sparse_matrix(other)
File "/usr/lib64/python2.6/site-packages/scipy/sparse/compressed.py", line 290, in _mul_sparse_matrix
indices = np.empty(nnz, dtype=np.intc)
ValueError: negative dimensions are not allowed
关于可能发生的事情的任何想法 - 在大约 64GB 内存的机器上运行它,并在执行点时使用大约 13GB。