[SciPy-user] TypeError: unsupported operand type(s) for +: 'slice' and 'int'

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Feb 21 03:53:22 CST 2006


Hi all,

The operation (see below for details) works fine with dense matrices but
not with sparse matrices.

shape(V) (317, 60) <type 'instance'>
shape(R0), type(R0) (317, 10) <type 'instance'>

Traceback (most recent call last):
  File "ggsl_sparse.py", line 116, in ?
    V,H,P = g_arnoldi(A,B,R0,n,s,k)
  File "ggsl_sparse.py", line 68, in g_arnoldi
    V[:,:s] = R0/beta
  File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
1191, in __setitem__
    self.indptr = resize1d(self.indptr, row+2)
TypeError: unsupported operand type(s) for +: 'slice' and 'int'

How can I fix this problem ?

Nils



More information about the SciPy-user mailing list