Here's another example of this annoying bug: ~$ python Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from numpy import * >>> from pysparse import * >>>m = 3 >>> n = 3 >>>A = spmatrix.ll_mat(m*n, m*n) >>> H = 3 >>> V = 2 >>> w=m*n >>> a = [0,0,] #row index >>> b = [0,1,] #column index >>> val = [H+V, -H,] #node value >>> nodec=0 >>> >>> 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)
>>> nodec=0 >>> 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)#row index, we skipped the first node ... val.append(-V) ... #print nodec ... #print a ... #print b ... #print val ... nodec=nodec+1 ... ... >>> >>> a = [0,0,] #row index >>> b = [0,1,] #column index >>> val = [H+V, -H,] #node value >>> nodec=0 >>> w=m*n >>> >>> nodec=0 >>> for i in range(w): ... b.append(nodec+1)#west neighbor ... a.append(nodec) ... val.append(-H) ... b.append(nodec-1)#east neighbor ... a.append(nodec) ... val.append(-H) ... nodec=nodec+1 ... >>> print a [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8] >>> print b [0, 1, 1, -1, 2, 0, 3, 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7] >>> print val [5, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3] >>> A.put(val,a,b) >>> A ll_mat(general, [9,9]): 5.000000 -3.000000 -------- -------- -------- -------- -------- -------- -------- -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -2.000000 -3.000000 -------- -3.000000 -------- -------- -------- -------- -------- -------- -------- -3.000000 -------- *** glibc detected *** python: double free or corruption (out): 0x09a93970 *** ======= Backtrace: ========= /lib/i686/cmov/libc.so.6[0xb7e081d4] /lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e0a186] /usr/lib/python2.5/site-packages/pysparse/spmatrix.so[0xb6b5c3bc] python[0x808c837] python(PyFile_WriteObject+0x73)[0x8072633] python[0x80f2748] python(PyObject_Call+0x27)[0x805d4b7] python(PyEval_CallObjectWithKeywords+0x6c)[0x80c88fc] python(PyEval_EvalFrameEx+0x4566)[0x80cddc6] python(PyEval_EvalCodeEx+0x685)[0x80d00c5] python(PyEval_EvalCode+0x57)[0x80d02d7] python(PyRun_InteractiveOneFlags+0x1e3)[0x80ed2f3] python(PyRun_InteractiveLoopFlags+0x48)[0x80ed548] python(PyRun_AnyFileExFlags+0x76)[0x80edca6] python(Py_Main+0xc07)[0x8059357] python(main+0x22)[0x8058722] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7daf775] python[0x8058661] ======= Memory map: ======== 08048000-08143000 r-xp 00000000 03:08 339193 /usr/bin/python2.5 08143000-08168000 rw-p 000fa000 03:08 339193 /usr/bin/python2.5 08168000-0816e000 rw-p 08168000 00:00 0 098d5000-09aa7000 rw-p 098d5000 00:00 0 [heap] b6a7d000-b6ac4000 r-xp 00000000 03:08 694922 /usr/lib/libsuperlu.so.3.0.0 b6ac4000-b6ac5000 rw-p 00047000 03:08 694922 /usr/lib/libsuperlu.so.3.0.0 b6ae0000-b6b41000 rw-p b6ae0000 00:00 0 b6b48000-b6b4b000 r-xp 00000000 03:08 377916 /usr/lib/python2.5/site-packages/pysparse/precon.so b6b4b000-b6b4c000 rw-p 00002000 03:08 377916 /usr/lib/python2.5/site-packages/pysparse/precon.so b6b4c000-b6b53000 r-xp 00000000 03:08 377913 /usr/lib/python2.5/site-packages/pysparse/jdsym.so b6b53000-b6b54000 rw-p 00006000 03:08 377913 /usr/lib/python2.5/site-packages/pysparse/jdsym.so b6b54000-b6b60000 r-xp 00000000 03:08 377912 /usr/lib/python2.5/site-packages/pysparse/spmatrix.so b6b60000-b6b62000 rw-p 0000c000 03:08 377912 /usr/lib/python2.5/site-packages/pysparse/spmatrix.so b6b62000-b6b76000 r-xp 00000000 03:08 361989 /usr/lib/python2.5/lib-dynload/_ctypes.so b6b76000-b6b78000 rw-p 00014000 03:08 361989 /usr/lib/python2.5/lib-dynload/_ctypes.so b6b78000-b6ba9000 r-xp 00000000 03:08 655985 /usr/lib/python2.5/site-packages/numpy/random/mtrand.so b6ba9000-b6bba000 rw-p 00031000 03:08 655985 /usr/lib/python2.5/site-packages/numpy/random/mtrand.so b6bba000-b721b000 r-xp 00000000 03:08 425393 /usr/lib/atlas/liblapack.so.3gf.0 b721b000-b721f000 rw-p 00660000 03:08 425393 /usr/lib/atlas/liblapack.so.3gf.0 b721f000-b732c000 rw-p b721f000 00:00 0 b732f000-b7335000 r-xp 00000000 03:08 377914 /usr/lib/python2.5/site-packages/pysparse/itsolvers.so b7335000-b7336000 rw-p 00006000 03:08 377914 /usr/lib/python2.5/site-packages/pysparse/itsolvers.so b7336000-b733b000 r-xp 00000000 03:08 360699 /usr/lib/python2.5/lib-dynload/_struct.so b733b000-b733c000 rw-p 00005000 03:08 360699 /usr/lib/python2.5/lib-dynload/_struct.so b733c000-b7346000 r-xp 00000000 03:08 655984 /usr/lib/python2.5/site-packages/numpy/fft/fftpack_lite.so b7346000-b7347000 rw-p 00009000 03:08 655984 /usr/lib/python2.5/site-packages/numpy/fft/fftpack_lite.so b7347000-b734b000 r-xp 00000000 03:08 655981 /usr/lib/python2.5/site-pacAborted I hope this helps somehow Oz. -- ---- Imagine there's no countries It isn't hard to do Nothing to kill or die for And no religion too Imagine all the people Living life in peace