我无法csr_matrix理解 scipy 文档中的示例:https ://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html
有人可以解释这个例子是如何工作的吗?
>>> row = np.array([0, 0, 1, 2, 2, 2])
>>> col = np.array([0, 2, 2, 0, 1, 2])
>>> data = np.array([1, 2, 3, 4, 5, 6])
>>> csr_matrix((data, (row, col)), shape=(3, 3)).toarray()
array([[1, 0, 2],
[0, 0, 3],
[4, 5, 6]])
我相信这是遵循这种格式。
csr_matrix((data, (row_ind, col_ind)), [shape=(M, N)])
where data, row_ind and col_ind satisfy the relationship a[row_ind[k], col_ind[k]] = data[k].
什么是a在这里吗?
互换的青春
尚方宝剑之说
相关分类