Hi Sam, FYI. I've experienced the same issue with csc matrices, cf. http://projects.scipy.org/scipy/scipy/ticket/316 Cheers, Martin On Monday 04 December 2006 14:52, Zhang Sam wrote:
Hi, there
I have several sparse matrices in coo_matrix format, say Y1, Y2, Y3, Y4. I want to get the sum of them and I use the operation: Y = Y1 + Y2 + Y3 + Y4.
When I print Y, it returns:
(0, 0) -17.3611111111j
(3, 0) 17.3611111111j (1, 1) -16j (7, 1) 16j (2, 2) -17.0648464164j (5, 2) 17.0648464164j (0, 3) 17.3611111111j (3, 3) (1.94219124871-27.792793163j) (3, 3) (1.36518771331-11.5160955631j) (4, 3) (-1.94219124871+10.5106820519j) (8, 3) (-1.36518771331+11.6040955631j) (3, 4) (-1.94219124871+10.5106820519j) (4, 4) (3.22420038714-15.8409270142j) (5, 4) (-1.28200913842+5.58824496236j) (2, 5) 17.0648464164j (4, 5) (-1.28200913842+5.58824496236j) (5, 5) (1.15508748089-26.7446168427j) (5, 5) (1.28200913842-5.40924496236j) (6, 5) (-1.15508748089+9.78427042636j) (5, 6) (-1.15508748089+9.78427042636j) (6, 6) (2.77220995414-23.3032490233j) (7, 6) (-1.61712247325+13.6979785969j) (1, 7) 16j (6, 7) (-1.61712247325+13.6979785969j) (7, 7) (1.61712247325-29.6234785969j) (7, 7) (1.18760437929-5.82213453331j) (8, 7) (-1.18760437929+5.97513453331j) (3, 8) (-1.36518771331+11.6040955631j) (7, 8) (-1.18760437929+5.97513453331j) (8, 8) (2.5527920926-17.3382300964j)
It is strange that there are two (3,3) entries, two (5,5) entries and two (7,7) entries. I have checked this result. It is correct if we add the two value together. What operation can let it return a sparse matrix which has only one value at every nonzero entry?
Thanks!
Sam Dec 4th, 2006