[LeetCode] Sparse Matrix Multiplication 稀疏矩阵相乘

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Sparse Matrix Multiplication 稀疏矩阵相乘相关的知识,希望对你有一定的参考价值。

 

Given two sparse matrices A and B, return the result of AB.

You may assume that A‘s column number is equal to B‘s row number.

Example:

A = [
  [ 1, 0, 0],
  [-1, 0, 3]
]

B = [
  [ 7, 0, 0 ],
  [ 0, 0, 0 ],
  [ 0, 0, 1 ]
]


     |  1 0 0 |   | 7 0 0 |   |  7 0 0 |
AB = | -1 0 3 | x | 0 0 0 | = | -7 0 3 |
                  | 0 0 1 |

 

 

 

s

以上是关于[LeetCode] Sparse Matrix Multiplication 稀疏矩阵相乘的主要内容,如果未能解决你的问题,请参考以下文章

Leetcode 311: Sparse Matrix Multiplication

[LeetCode] 311. Sparse Matrix Multiplication 稀疏矩阵相乘

LeetCode 311. Sparse Matrix Multiplication

python使用scipy中的sparse.csr_matrix函数将numpy数组转化为稀疏矩阵(Create A Sparse Matrix)

python稀疏矩阵sparse matrix的保存和读取

[Locked] Sparse Matrix Multiplication