[SciPy-user] Interaction of sparse and dense matrices in scipy
Ed Schofield
schofield at ftw.at
Mon Feb 20 11:23:10 CST 2006
Nils Wagner wrote:
>I need some advice on operations between dense and sparse matrix "objects".
>Which operations are possible in scipy ?
>
><snip>
>
>- 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
More information about the SciPy-user
mailing list