Ring Zero.
Ring Zero.

Reputation: 469

sparse matrix multiplication with python

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 ?

Upvotes: 0

Views: 940

Answers (1)

Rishabh Malhotra
Rishabh Malhotra

Reputation: 269

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

Upvotes: 1

Related Questions