【发布时间】:2017-08-26 12:46:04
【问题描述】:
(Python) 任何人都可以建议使用来自另一个大小为 400k*800k 的 csr 矩阵 B 的列中的值填充 csr 矩阵 A 的最简单和最快的方法。 我的失败尝试:
#x is a list of size 500 which contains the column numbers needed from B
A=sparse.csr_matrix((400000,500))
for i in range(400000):
for j in range(500):
A[i,j]=B[i,x[j]]
还有一种简单的方法可以将矩阵 B 以 4:1 的比例拆分
【问题讨论】:
标签: python scipy sparse-matrix