Perform matrix multiplication between two arrays and get result only on masked places

前端 未结 3 711
夕颜
夕颜 2021-01-24 17:18

I have two dense matrices, A [200000,10], B [10,100000]. I need to multiply them to get matrix C. I can\'t do that directly, s

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-24 17:50

    First, get the indexes of the non zero places in W, and then you can just get the (i,j) element of the result matrix by multiplying the i-th row in A with the j-th column in B, and save the result as a tuple (i,j,res) instead of saving it as a matrix (this is the right way to save sparse matrices).

提交回复
热议问题