[SciPy-Dev] utility for composing sparse matrices

Pauli Virtanen pav@iki...
Mon Sep 20 04:25:25 CDT 2010


Mon, 20 Sep 2010 10:26:58 +0200, Robert Cimrman wrote:
> FYI: I have created a function that creates a sparse matrix from sparse
> (or dense) blocks, somewhat in the spirit of np.r_ and friends, see the
> example below.
> 
> Shall we add it to scipy.sparse? It may help to go around some of the
> fancy-indexing limitations.

Add some tests, and I see no problem in putting it in. Also, I'd check 
that cases such as

	compose_sparse([A, B])
	compose_sparse(A)

are handled sensibly.

Also, the equivalent function in `Numpy` is called `bmat`. Should the 
name here reflect that.

Also, we would need to think if it is possible to get the sparse matrices 
in Scipy to play along with functions in Numpy. (E.g. np.bmat() and 
np.linalg.dot() doing the correct stuff for sparse matrices.)

	Pauli



More information about the SciPy-Dev mailing list