# [SciPy-dev] scipy.sparse.linalg segfaults for complex data

josef.pktd@gmai... josef.pktd@gmai...
Wed Dec 9 18:17:17 CST 2009

```On Wed, Dec 9, 2009 at 7:05 PM, Jake VanderPlas <jakevdp@gmail.com> wrote:
> Hello,
> I just opened a ticket for this problem (#1067), but I'd like to get
> this out to the list.  I've found that the iterative solvers in
> scipy.sparse.linalg produce Segmentation Faults for complex inputs.
> Below is a simple example (for scipy v0.7.1).  Should these functions
> support complex data?  If not, does anyone know a good way to solve
> general linear systems for complex input?  I say general because I
> don't actually have a matrix per se, but a LinearOperator which
> implements its matvec method using scipy.fftpack.
> Thanks
>   Jake
>
>
> import numpy as np
> from scipy.sparse.linalg import cg
>
> N = 2
> M = np.random.random((N,N)) + 1j*np.random.random((N,N))
> v = np.random.random(N)
> cg(M,v)  #segmentation fault is here

no problems here (WindowsXP, no umfpack)

>>> N=2
>>> M = np.random.random((N,N)) + 1j*np.random.random((N,N))
>>> v = np.random.random(N)
>>> import scipy.sparse.linalg as sla
>>> sla.cg(M,v)
(array([ 0.26265867+0.61820443j,  1.48541897-2.13027697j]), 20)

>>> scipy.version.version
'0.8.0.dev6118'
>>> np.version.version
'1.4.0rc1'

Josef
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
```