[SciPy-User] segfault using _sparse_ svd, eigen, eigen_symmetric with svn 0.9.0.dev6598
Jose Quesada
quesada at gmail.com
Wed Jul 21 11:59:45 EDT 2010
Hi,
We are on a coding sprint trying to implement sparse matrix support in MDP (
http://sourceforge.net/apps/mediawiki/mdp-toolkit/index.php?title=MDP_Sprint_2010).
The new sparse.linalg is very useful here.
We are getting segfaults using _sparse_ svd, eigen, eigen_symmetric with svn
0.9.0.dev6598. I understand that (1) this is an unreleased version, and (2)
these methods may depend on external C and fortran code that could have not
being installed well on my machine, so this may be difficult to debug. I
have added instructions to reproduce the segfault, but please ask for
anything else that could be needed and I'll try to provide it.
I installed the svn version on a virtualenv using pip:~/.virtualenvs/sprint$
pip install svn+http://svn.scipy.org/svn/scipy/trunk/#egg=scipyc
This generates a long log that could contain the explanation, so I posted it
here (going as far back as my terminal's scrollback enabled:
http://pastebin.org/410867
Last, here's an example that reproduces the segfault:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#--------------------------
# simply run an svd on a a sparse matrix, svn 0.9.0.dev6598
#--------------------------
import scipy
from scipy import sparse
from numpy.random import rand
# create random sparse matrix
x = scipy.sparse.lil_matrix((1000000, 1000000))
x[0, :100] = rand(100)
x[1, 100:200] = x[0, :100]
x.setdiag(rand(1000))
x = x.tocsr() # convert it to CSR
#v, u, w = scipy.sparse.linalg.eigen_symmetric(x) # segmentation fault
# try a simpler matrix
y = scipy.sparse.lil_matrix((10, 10))
y.setdiag(range(10))
y = y.tocsr() # convert it to CSR
#v, u, w = scipy.sparse.linalg.eigen_symmetric(y) #
#./sampleSegFault.py
#Traceback (most recent call last):
#File "./sampleSegFault.py", line 13, in <module>
#x[0, :100] = rand(100)
#File
"/home/quesada/.virtualenvs/sprint/lib/python2.6/site-packages/scipy/sparse/lil.py",
line 319, in __setitem__
#x = lil_matrix(x, copy=False)
#File
"/home/quesada/.virtualenvs/sprint/lib/python2.6/site-packages/scipy/sparse/lil.py",
line 98, in __init__
#A = csr_matrix(A, dtype=dtype).tolil()
#File
"/home/quesada/.virtualenvs/sprint/lib/python2.6/site-packages/scipy/sparse/compressed.py",
line 71, in __init__
#self._set_self( self.__class__(coo_matrix(arg1, dtype=dtype)) )
#File
"/home/quesada/.virtualenvs/sprint/lib/python2.6/site-packages/scipy/sparse/coo.py",
line 171, in __init__
#self.data = M[self.row,self.col]
#ValueError: shape mismatch: objects cannot be broadcast to a single
shape
#*** glibc detected *** python: double free or corruption (!prev):
0x0000000004075ec0 ***
# some other linalg methods
ly,v = scipy.sparse.linalg.eig(y) # segmentation fault
#====#
Thanks a lot in advance,
-Jose
Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition,
Berlin
http://www.josequesada.name/
http://twitter.com/Quesada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100721/e9ac927a/attachment.html>
More information about the SciPy-User
mailing list