From: Adam C P. IV <haz...@de...> - 2009-08-04 13:59:28
|
Hi, The following segfault-inducing code came in from a user (details at http://bugs.debian.org/535318 ): from numpy import * from pysparse import * m = 4 n = 3 nodec=0 A = spmatrix.ll_mat(m*n, m*n) H = 3 V = 2 a = [0,0,0,] #row index b = [0,1,n] #column index val = [H+V, -H, -V] #node value w=m*n nodec=0 w=m*n bottomr=w-n for i in range(w): for j in range(w): if (nodec)<bottomr:#check necessary to make sure we don't #try puting south neighbours for the bottom row of nodes b.append(nodec+n) a.append(nodec-1)#row index, we skipped the first node val.append(-V) nodec=nodec+1 A.put(val,a,b) print A for i in range(w): for j in range(w): if (nodec-n)>=0: #check necessary to make sure we don't #try puting north neighbours for the top row of nodes b.append(nodec-n) a.append(nodec-1)#row index val.append(-V) nodec=nodec+1 A.put(val,a,b) print A Also a log of crash: In [20]: a Out[20]: [1, 3, 5] In [21]: b Out[21]: [2, 3, 5] In [22]: c Out[22]: [4, 5, 9] In [23]: A.take(c,a,b) Segmentation fault Any ideas? Bug in user's code, pysparse, or Debian packaging? Thanks, -Adam -- GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6 Engineering consulting with open source tools http://www.opennovation.com/ |