[SciPy-dev] Segfault

Travis Oliphant oliphant at ee.byu.edu
Thu Apr 27 11:36:56 CDT 2006


Nils Wagner wrote:

>Travis Oliphant wrote:
>  
>
>>Nils Wagner wrote:
>>  
>>    
>>
>>>Hi all,
>>>
>>>I am going to visualize the sparsity pattern of large matrices using
>>>numpy/scipy/matplotlib.
>>>I received a segfault running the following script
>>>
>>>from pylab import show, plot, axis, xlabel, subplot, title, spy
>>>from scipy import *
>>>
>>>K = io.mmread('k.mtx')
>>>M = io.mmread('m.mtx')
>>>print 'Reading finished'
>>>
>>>K = K.todense()
>>>spy(K)
>>>show()
>>>
>>>  
>>>    
>>>      
>>>
>>Thanks for the traceback.  It looks like an error was not being caught.  
>>This is now fixed in SVN f2py.  Your code should now raise an error that 
>>is occurring in trying to convert an object to an array in mmread...
>>
>>-Travis
>>  
>>    
>>
>Reading finished
>Traceback (most recent call last):
>  File "matrixstructure.py", line 8, in ?
>    K = K.todense()
>  File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
>356, in todense
>    return asmatrix(self.toarray())
>  File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
>360, in toarray
>    return csc.toarray()
>  File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
>969, in toarray
>    return func(self.shape[0], self.data, self.rowind, self.indptr)
>MemoryError
>
>  
>

Could you use pdb

import pdb
pdb.pm()

to find out what self.shape[0] is? 

This will help track down the problem.

-Travis




More information about the Scipy-dev mailing list