[SciPy-user] ValueError: need more than 1 value to unpack
Nils Wagner
nwagner at mecha.uni-stuttgart.de
Thu Mar 16 05:56:23 CST 2006
Ed Schofield wrote:
> Nils Wagner wrote:
>
>> Is this a bug ?
>>
>> A_csc = csc_matrix((3,3),Complex128)
>> File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
>> 521, in __init__
>> (M, N) = dims
>> ValueError: need more than 1 value to unpack
>>
>>
>
> This works fine for me:
>
>
>>>> from scipy import sparse as s
>>>> import numpy
>>>> A_csc = s.csc_matrix((3,3), numpy.complex128)
>>>>
>
> Try with a lowercase 'complex128'. I think the uppercase dtype names
> are deprecated, but also _different_ to the lowercase dtype names, so
> Complex128 would be equivalent to complex256 -- that is, the real and
> imaginary components are both 128-bit floats. Complex128, with
> uppercase 'C', is not even defined on my 32-bit machine...
>
>
On a 32bit system
A_csc = s.csc_matrix((3,3),Complex128)
NameError: name 'Complex128' is not defined
If I use a lowercase dtype name
A_csc = s.csc_matrix((3,3),complex128)
for i in arange(0,3):
A_csr[i,i] = 1.0+2j
A_csc[i,i] = 1.0+2j
>>> A_csc
<3x3 sparse matrix of type '<type 'float64scalar'>'
with 3 stored elements (space for 100)
in Compressed Sparse Column format>
Note that the imaginary part is missing !
>>> print A_csc
(0, 0) 1.0
(1, 1) 1.0
(2, 2) 1.0
Nils
> But it looks like a bug anyway. Robert C., do you have a 64-bit machine
> to investigate this?
>
> -- Ed
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
More information about the SciPy-user
mailing list