[SciPy-user] Interaction of sparse and dense matrices in scipy

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Feb 21 02:48:29 CST 2006

Ed Schofield wrote:
>Nils Wagner wrote:
>>I need some advice on operations between dense and sparse matrix "objects".
>>Which operations are possible in scipy ?
>>- multiplication of a sparse matrix A with a dense matrix C
>>- Kronecker product of sparse matrices ?
>>- Kronecker product of a dense and a sparse matrix ?
>>- sparse matrix functions expm(A),... ?
>>- sparse eigensolver
>I don't know about all of these, but currently multiplication works
>between arrays by sparse matrices (and should be efficient) and you can
>achieve exponentiation for integer powers by repeated multiplication. 
>But currently multiplication a * b does NOT work if 'a' is a dense
>*matrix* and 'b' is sparse.  I'd like to fix this, but it's not easy,
>and we'd need to discuss how.
>>Can I use different sparse formats like csc and csr w.r.t. to
>>multiplication, addition,...
>Yes, it should work for any two formats, but one matrix will usually be
>converted internally to the same format as the other, so it's more
>efficient to use the same format unless you know what you're doing.
>>And what is the output of A = io.mmread("A.mtx") ? I mean sparse or dense.
>It should be the same format that it was stored in.
>-- Ed
>SciPy-user mailing list
>SciPy-user at scipy.net

Hi Ed,

Thank you for your valuable comments.
The multiplication a*b, where a is dense a b is sparse, is certainly of
For example Block Krylov methods make heavily use of such products.
Anyway, it would be nice if scipy can handle such products :-)

Any comments or suggestions ?


Some References


Maybe we can benift from octave in some sense.


Sparse Kronecker product

Sparse random matrices


More information about the SciPy-user mailing list