我有一个A
格式的矩阵coo
(它是从scipy.sparse.bmat
创建的):
A
<80000x80000 sparse matrix of type '<class 'numpy.float64'>'
with 278480 stored elements in COOrdinate format>
我想
g
求spsolve(A, g)
现在,我无法更改coo
格式的行。以下工作:
但我会得到
SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
SparseEfficiencyWarning)
现在,据我所知,lil_matrix
在解线性代数时效率低下,所以即使我将稀疏结构改为lil
,我也会/应该在之后改回csr
或{
总的来说,这值得吗?我不想快速测试我在这里所做的每一个操作:有没有经验法则来说明“改变稀疏性”与“行切片”与“算术运算”的代价有多高?程序员通常如何处理这类问题?在
尽管有警告,但一次性更改
^{1}$csr
比往返lil
要好:相关问题 更多 >
编程相关推荐