[SciPy-user] Construct sparse matrix from sparse blocks

Nathan Bell wnbell@gmail....
Sat Feb 9 01:32:55 CST 2008

On Feb 8, 2008 3:42 PM, Neilen Marais <nmarais@sun.ac.za> wrote:
> All else being equal I prefer verbose and tab-completable, although it
> can get a bit much. I'm actually in favour of Anne's suggestion of using
> namespaces, though I'd put them in the sparse, rather than splinalg
> namespaces. I envision working like this:

scipy.sparse.bmat lives!

I haven't done it yet, but I think sparse.hstack() and sparse.vstack()
can be implemented via sparse.bmat() quite easily.

E.g. something like:

def hstack( blocks ):
    return bmat( [blocks] )

def vstack( blocks ):
   return bmat( [ [b] for b in blocks ] )

Feel free to contribute additional unittests for bmat() as the current
ones are fairly simple.

Nathan Bell wnbell@gmail.com

More information about the SciPy-user mailing list