[SciPy-user] Construct sparse matrix from sparse blocks

Neilen Marais nmarais@sun.ac...
Fri Feb 8 14:43:18 CST 2008

Hi Nathan

On Fri, 08 Feb 2008 12:02:41 -0600, Nathan Bell wrote:

> On Feb 8, 2008 8:15 AM, Neilen Marais <nmarais@sun.ac.za> wrote:

> Thanks for sharing this with us.  I think it would make a useful
> addition to scipy.sparse, so if there are no objections I'll integrate
> it in some form.

+1 from me :)

> Do you actually need the the row and column offset, or would a sparse
> analog of numpy's bmat() be more appropriate?
> http://www.scipy.org/Numpy_Example_List_With_Doc#bmat
> Specifically, would it be preferable to produce your example
>  A = [A_aa  0   ]
>        [0     A_bb]
> using the interface merge_sparse_blocks currently supports or something
> like bmat_sparse( [[A_aa, None],[None,A_bb]] )
> We could also provide hstack_sparse() and vstack_sparse() functions
> also.  Thoughts?

I was unaware of the bmat like interface. I simply implemented the 
interface that seemed easiest implementation wise to me. Both the bmat 
and sparse hstack/vstack interfaces sound pretty nice to me... Avoids the 
possiblity of messing up the offsets.


More information about the SciPy-user mailing list