From: Artur P. <art...@gm...> - 2008-06-17 09:33:02
|
Hi to you all, I hope someone can help me. I am trying to do the following with pysparse but I am having problems doing it. I have a dense vector, say: x = numpy.arange(0,10) and a sparse matrix: A = pysparse.spmatrix.ll_mat(10,10) What I wish to do is: x = x + A[:, 2] But this gives the following error: TypeError: unsupported operand type(s) for +: 'float' and 'll_mat' Then I tried like this: x = numpy.arange(0,10) A = pysparse.sparray.sparray((10,10)) With this it works ok but then, when I try to do a slice: A_reduced = A[0:5, 0:5] It gives an error: TypeError: unsupported operand type(s) for +: 'int' and 'slice' Anybody can give a help? Also, what is the main difference between spmatrix and sparray? Thanking in advance Best regards -artur palha |