# [SciPy-dev] Segmentation fault using linsolve

Nils Wagner nwagner at iam.uni-stuttgart.de
Wed Nov 22 10:45:51 CST 2006

```Tim Leslie wrote:
> On 11/23/06, Nils Wagner <nwagner at iam.uni-stuttgart.de> wrote:
>
>> Hi all,
>>
>> Can someone reproduce the segfault by running the following test
>>
>
> I can confirm a segfault using:
>
> Python 2.4.4c1 (#2, Oct 11 2006, 20:00:03)
> [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
>
>>>> import scipy, numpy
>>>>
> s>>> scipy.__version__, numpy.__version__
> ('0.5.2.dev2322', '1.0.1.dev3435')
>
> HTH
>
> Tim
>
>
Thank you Tim. Meanwhile I have added a line A = A.tocsc() see below

from scipy import *

n = 15
A = sparse.lil_matrix((n,n))
for i in arange(0,n):
A[i,:n] = random.rand(n)
A = A.tocsc()
B = 2.*sparse.speye(n,n)
sigma =  1.0
sigma_solve = linsolve.splu(A - sigma*B).solve
print sigma_solve

If I run the script in interactive mode I get

python -i test_linsolve.py
Use minimum degree ordering on A'+A.
*** glibc detected *** free(): invalid next size (fast):
0x00000000008d3c30 ***
Abort

If I run the script without -i I get

python test_linsolve.py
Use minimum degree ordering on A'+A.
<built-in method solve of factored_lu object at 0x2aaab36d8c60>

Any idea ?

Nils

>> from scipy import *
>>
>> n = 15
>> A = sparse.lil_matrix((n,n))
>> for i in arange(0,n):
>>   A[i,:n] = random.rand(n)
>> B = 2.*sparse.speye(n,n)
>> sigma =  1.0
>> sigma_solve = linsolve.splu(A - sigma*B).solve
>>
>>
>> Nils
>>
>> I am using the latest svn versions of numpy/scipy.
>> This is the output of gdb
>>
>> GNU gdb 6.3
>> Copyright 2004 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and you are
>> welcome to change it and/or distribute copies of it under certain
>> conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for details.
>> This GDB was configured as "x86_64-suse-linux"...(no debugging symbols
>> found)
>>
>> (gdb) run test_linsolve.py
>> Starting program: /usr/bin/python test_linsolve.py
>> (no debugging symbols found)
>> (no debugging symbols found)
>> [New Thread 46912509653888 (LWP 6613)]
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> Use minimum degree ordering on A'+A.
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 46912509653888 (LWP 6613)]
>> 0x00002aaab0e6e9a1 in genmmd_ (neqns=0x7fffffa847ac, xadj=0x8d6d60,
>> adjncy=0x998550, invp=0x8e19ec, perm=0x88cb20, delta=0x7fffffa847a4,
>>     dhead=0x8e196c, qsize=0x8e6040, llist=0x92bcbc, marker=0x94c78c,
>> maxint=0x7fffffa847a0, nofsub=0x7fffffa8479c) at mmd.c:162
>> 162             perm[nextmd] = -mdeg;
>>
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev at scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-dev
>>
>>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>

```