[SciPy-user] Converting matrices from pysparse

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Jun 29 07:16:17 CDT 2007

Hi all,

Just now I have installed pysparse via
It works fine for me !

Is it possible to convert matrices from the pysparse specific format
into a format such
that I can visualize them with pylab.spy ?

>>> type(A)
<type 'sss_mat'>
>>> from pylab import spy, show
>>> spy(A)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/site-packages/matplotlib/pylab.py", line
2281, in spy
    ret =  gca().spy(*args, **kwargs)
  File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line
5089, in spy
    nr, nc = Z.shape
ValueError: need more than 0 values to unpack
I have used the following example from the website

from pysparse import itsolvers, poisson, precon, jdsym

A = poisson.poisson2d_sym(200).to_sss()
K = precon.ssor(A)
k_conv, lmbd, Q, it, it_inner  = \
    jdsym.jdsym(A, None, K, 5, 0.0, 1e-10, 150, itsolvers.qmrs, clvl=1)


More information about the SciPy-user mailing list