[SciPy-dev] sparse kronsum

Nils Wagner nwagner@iam.uni-stuttgart...
Sun Feb 10 03:53:30 CST 2008


Hi Nathan,

Thank you very much for implementing kronsum !

I just tried it out. print does not work
for matrices given in block sparse row format.
  
B = coo_matrix([[1.+1j,2],[3,4-1j]])
print B results in
   (0, 0)        (1.0+1.0j)
   (0, 1)        (2.0+0.0j)
   (1, 0)        (3.0+0.0j)
   (1, 1)        (4.0+-1.0j)

Please note that there are two signs in the last entry.
It should be 4.0-1.0j instead of 4.0+-1.0j.


/usr/bin/python -i test_spkronsum.py
   (0, 0)        (1.0+1.0j)
   (0, 1)        (2.0+0.0j)
   (1, 0)        (3.0+0.0j)
   (1, 1)        (4.0+0.0j)
   (0, 0)        (1.0+1.0j)
   (0, 1)        (2.0+0.0j)
   (1, 0)        (3.0+0.0j)
   (1, 1)        (4.0+-1.0j)
[[ 2.+2.j  2.+0.j  2.+0.j  0.+0.j]
  [ 3.+0.j  5.+1.j  0.+0.j  2.+0.j]
  [ 3.+0.j  0.+0.j  5.+0.j  2.+0.j]
  [ 0.+0.j  3.+0.j  3.+0.j  8.-1.j]]
Traceback (most recent call last):
   File "test_spkronsum.py", line 11, in ?
     print G
   File 
"/usr/lib/python2.4/site-packages/scipy/sparse/base.py", 
line 167, in __str__
     val = val + self.listprint(0, nnz)
   File 
"/usr/lib/python2.4/site-packages/scipy/sparse/base.py", 
line 148, in listprint
     return '\n'.join(['  %s\t%s' % (self.rowcol(ind), 
self.getdata(ind))
   File 
"/usr/lib/python2.4/site-packages/scipy/sparse/bsr.py", 
line 269, in getdata
     raise NotImplementedError
NotImplementedError
  

Cheers,
           Nils
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_spkronsum.py
Type: text/x-python
Size: 179 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20080210/36d2b635/attachment.py 


More information about the Scipy-dev mailing list