从其属性(数据,行,列)初始化COO矩阵



我有一个脚本来计算COO格式的三个属性:

data    COO format data array of the matrix
row     COO format row index array of the matrix
col     COO format column index array of the matrix

我想使用这三个数组来初始化 coo_matrix((,以便使用 coo_matrix 类可用的方法。在不更改主脚本的情况下做到这一点的最快方法是什么?

scipy.sparse文档

coo_matrix((data, (row, column)), [shape=(M, N)])

最新更新