thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

segmentation fault with dot product of sparse matrices (migrated from Trac #1983) #3531

Open thouis opened 12 years ago

thouis commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/1983 Reported 2011-11-18 by trac user fp4code, assigned to unknown.

The dot product of two sparse matrices crashes python. The defect has appeared with

commit 867cabefe92b127b765580432b4c05d92342e275
Author: Mark Wiebe <mwiebeatmention:enthought.com>
Date:   Fri Jul 22 10:24:14 2011 -0500

Here an example:

######################################
import sys, numpy, scipy, scipy.sparse
md = numpy.matrix(numpy.zeros((2,2))); md[0,1]=-1; md[1,0]=1
ms = scipy.sparse.lil_matrix(md)
print(sys.version)           # 2.7.2 [GCC 4.5.2]
print(numpy.version.version) # 2.0.0.dev-867cabe to 7297785
print(scipy.version.version) # 0.11.0.dev-badad3f or earlier
print(md*md)                 # OK
print(numpy.dot(md,md))      # OK
print(ms*ms)                 # OK
print(numpy.dot(ms,ms))      # Segmentation fault #
###################################################
thouis commented 12 years ago

Comment in Trac by atmention:nilswagner01, 2011-11-19

[[-1. 0.] [ 0. -1.]] [[-1. 0.] [ 0. -1.]](0, 0) -1.0 (1, 1) -1.0

Program received signal SIGSEGV, Segmentation fault. PyArray_MatrixProduct2 (op1=0xce1390, op2=0xce1390, out=0x0) at numpy/core/src/multiarray/multiarraymodule.c:955 955 Py_INCREF(typec); (gdb) bt

0 PyArray_MatrixProduct2 (op1=0xce1390, op2=0xce1390, out=0x0)

at numpy/core/src/multiarray/multiarraymodule.c:955

1 0x00007ffff5f6dd79 in dotblas_matrixproduct (

__NPY_UNUSED_TAGGEDdummy=<value optimized out>, 
args=<value optimized out>, kwargs=<value optimized out>)
at numpy/core/blasdot/_dotblas.c:254

2 0x00007ffff7b2166c in PyEval_EvalFrameEx ()

from /usr/lib64/libpython2.6.so.1.0

3 0x00007ffff7b26441 in PyEval_EvalCodeEx ()

from /usr/lib64/libpython2.6.so.1.0

4 0x00007ffff7b1fa32 in PyEval_EvalCode ()

from /usr/lib64/libpython2.6.so.1.0

5 0x00007ffff7b3a7a1 in ?? () from /usr/lib64/libpython2.6.so.1.0

6 0x00007ffff7b3aba4 in PyRun_FileExFlags ()

from /usr/lib64/libpython2.6.so.1.0

7 0x00007ffff7b3b299 in PyRun_SimpleFileExFlags ()

from /usr/lib64/libpython2.6.so.1.0

8 0x00007ffff7b42638 in Py_Main () from /usr/lib64/libpython2.6.so.1.0

9 0x00007ffff6e8eb7d in __libc_start_main () from /lib64/libc.so.6

10 0x00000000004006e9 in _start ()