[SciPy-User] Sparse Dense Matrix Multiplication

Oleksandr Huziy guziy.sasha at gmail.com
Tue Nov 13 09:45:35 EST 2012


You could do the following:

import scipy as sp
from scipy import sparse
m = sparse.identity(2)
m1 = np.matrix([[1, 2], [3,4]])
type(m*m1)
print(type(m*sparse.csr_matrix(m1)))

Cheers
--
Oleksandr (Sasha) Huziy


2012/11/9 رامي الرفوع <rmyeid at gmail.com>

> Hi All,
>
> I would like to ask if scipy offers the following functionality:
>
> Dense Matrix * Sparse Matrix = Sparse Matrix.
>
> It is not element-wise multiplication, it is matrix-matrix multiplication.
>
>
> Regards.
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121113/ad1d68ff/attachment.html>


More information about the SciPy-User mailing list