[SciPy-user] Converting matrices from pysparse

Dominique Orban dominique.orban@gmail....
Fri Jun 29 10:21:46 CDT 2007

Nils Wagner wrote:
> Hi all,
> Just now I have installed pysparse via
> http://people.web.psi.ch/geus/pyfemax/download.html.
> 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 'sss_mat'>

Hi Nils,

In Pysparse, it is much easier to deal with the linked-list format (ll_mat) for 
matrix updates/visualization. The compressed sparse row (csr) and sparse skyline 
(sss) formats are useful when it comes to computation (e.g., csr is faster for 
matrix-vector products).

In NLPy (nlpy.sf.net), which is based on Pysparse, I wrote a sparsity pattern 
visualizer for ll_mat matrices and Matplotlib. This is how it goes:

import sparsetools
import pylab
M = sparsetools.rdm( 200, nnz = 250 )   # Create a random ll_mat
(a,h) = sparsetools.spymatll( M, color = True )

I have been using Pysparse, Pylab and Python to combine efficient optimization 
building blocks into an environment in which it is easy to write optimization 
algorithms. If there is an interest, I'd be ready to join efforts.


More information about the SciPy-user mailing list