[SciPy-user] More problems with Sparse
nwagner at mecha.uni-stuttgart.de
Wed Oct 27 02:30:12 CDT 2004
Robert Kern wrote:
> Nils Wagner wrote:
>> Hi Travis,
>> A few days ago I have reported on the following bug in sparse.
>> (recent Bug tracker entries)
>> It would be nice if this problem could be fixed.
>> Thanks in advance.
>>>>> from scipy import *
>>>>> A = sparse.dok_matrix()
>>>>> A[0,0] = 1j
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> File "/usr/lib/python2.3/site-packages/scipy/sparse/Sparse.py", line
>> 1326, in todense
>> new[ikey0,ikey1] = self[key]
>> TypeError: can't convert complex to float; use abs(z)
> It's difficult to determine beforehand if a matrix needs to be complex
> or not. The default typecode for the dense array is 'd' (double
> precision real). Use the typecode keyword argument to todense() to
> choose something else.
> I found this out in 30 seconds by looking at the source code.
Thank you. A tutorial illustrating all these features would be very
Again, I have some trouble with complex matrices and iterative solvers.
File "sparse_it.py", line 38, in ?
sol0,info0 = linalg.gmres(A,r)
line 499, in gmres
work[slice2] += sclr1*matvec(work[slice1])
TypeError: return array has incorrect type
How can I resolve this problem ?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1303 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20041027/19472cd5/sparse_it.py
More information about the SciPy-user