[Numpy-discussion] np.dot and scipy sparse matrices
Stéfan van der Walt
stefan at sun.ac.za
Wed Nov 9 14:27:11 EST 2011
Hi Peter
On Wed, Nov 9, 2011 at 3:38 AM, Peter Prettenhofer
<peter.prettenhofer at gmail.com> wrote:
> I recently got the latest numpy version (2.0.0.dev-7297785) from the
> git repo and realized that `np.dot` causes a segfault if its operands
> are scipy sparse matrices. Here's some code to reproduce the problem::
>
> import numpy as np
> from scipy import sparse as sp
> A = np.random.rand(10, 10)
> S = sp.csr_matrix(A)
> _ = np.dot(A, A) # this works OK
> _ = np.dot(S, S) # this segfaults!
Here's a patch to get rid of the segfault:
https://github.com/numpy/numpy/pull/170
I don't know if np.dot is supposed to know anything about sparse
matrices; if so, then a fancier change may be needed.
Regards
Stéfan
More information about the NumPy-Discussion
mailing list