0

I wonder how to do matrix multiplication if one of the matrices is sparse. the mul(A,B) command does not support sparse matrices as far as I know, Should I write my own routine ?

A sparse matrix such as lil_matrix B full matrix, any regular matrix or ndarray.

C = A*B , * being matrix multiplication ?

Ring Zero.
  • 459
  • 3
  • 12
  • possible duplicate of [Matrix multiplication for sparse matrices in Python](http://stackoverflow.com/questions/7477733/matrix-multiplication-for-sparse-matrices-in-python) – Carsten Mar 24 '15 at 14:16
  • Matrix multiplication is not the same as element wise multiplication. – Ring Zero. Mar 24 '15 at 17:12

1 Answers1

1

You should look at module scipy.sparse. I think it should get the job done fairly quickly. Obviously you would need the Scipy and numpy library for this though.

For More info please read the following answer: Matrix multiplication for sparse matrices in Python

Community
  • 1
  • 1
Rishabh Malhotra
  • 269
  • 3
  • 13