I have this example of matrix by matrix multiplication using numpy arrays:
import numpy as np
m = np.array([[1,2,3],[4,5,6],[7,8,9]])
c = np.array([0,1,2])
m * c
array([[ 0, 2, 6],
[ 0, 5, 12],
[ 0, 8, 18]])
How can i do the same thing if m is scipy sparse CSR matrix? This gives dimension mismatch:
sp.sparse.csr_matrix(m)*sp.sparse.csr_matrix(c)
*multiplication is element by element with arrays, but the matrix product with sparse matrices. - hpaulj