[SciPy-Dev] Gmres with Sparse Complex Matrices gives Segmentation fault (or NULL result)

Martin Campos Pinto mcp.stras@gmail....
Mon Dec 3 22:47:29 CST 2012


Le 11/28/12 7:26 PM, Pauli Virtanen a écrit :
> Hi,
> 28.11.2012 06:56, Martin Campos Pinto kirjoitti:
>> I have just tried with scipy version 0.11.0, installed with mac ports
>> and gmres runs without crashing.
>> Since scipy 0.10.1 was the package provided with EPD I first thought it
>> should run fine...
> That is sort of strange in itself, given that there are essentially no
> changes between 0.10.1 and 0.11.0 in that part of code. The test suite
> also includes complex-valued test problems for gmres, so it not crashing
> is also not immediately understood.
> If the crashing version was 0.9.0 or earlier, then I'd understand what
> is going on... If you still can, double-checking what
> 'print scipy.__version__' said could be useful.

I have just reinstalled my os (for reasons not related to scipy...) and 
updated the scipy mac ports install but not the EPD one,
but that one already used scipy 0.10.0 and the result is the same. 
Here's the test with the scipy version number written down:

import scipy
from scipy import sparse
from numpy.linalg import norm
from numpy.random import rand
import scipy.sparse.linalg as spla

print "scipy version: ", scipy.__version__

C = sparse.lil_matrix((10, 10), dtype=complex)
C[0,3] = 1j
C = C.tocsr()
c = rand(10)+rand(10)*1j

x = spla.spsolve(C, c)
print "spsolve: norm(C*x - c) = ", norm(C*x - c)

(x,info) = spla.gmres(C, c)
print "gmres: norm(C*x - c) = ", norm(C*x - c)


1. with the python binary installed with mac ports: Python 2.7.3 
(default, Oct 22 2012, 06:12:28)

Martins-MacBook-Pro:~ campos$ /opt/local/bin/python2.7 test_gmres_cplx.py
scipy version:  0.11.0
spsolve: norm(C*x - c) =  2.60370378581e-16
gmres: norm(C*x - c) =  1.21827900786e-06

2. with the python binary installed with EPD: Python 2.7.2 |EPD 7.2-2 
(64-bit)| (default, Sep  7 2011, 16:31:15)

Martins-MacBook-Pro:~ campos$ python test_gmres_cplx.py
scipy version:  0.10.0
spsolve: norm(C*x - c) =  2.48641008715e-16
Segmentation fault

Best, Martin

Martin Campos Pinto

More information about the SciPy-Dev mailing list