Scipy sparse invert or spsolve lead to UMFPACK_ERROR_OUT_OF_MEMORY

后端 未结 2 1162
小鲜肉
小鲜肉 2021-02-19 15:20

I am trying to invert a large (150000,150000) sparse matrix as follows:

import scipy as sp
import scipy.sparse.linalg as splu

#Bs is a large sparse         


        
2条回答
  •  南旧
    南旧 (楼主)
    2021-02-19 15:32

    A sparse array only fits the non-zero entries of your matrix into memory. Now suppose you do an inversion. This means that almost all entries of the matrix become non-zero. Sparse matrices are memory optimized.

    There are some operations which you can apply on sparse matrices without losing the "spare" property:

    • Addition, just adding a constant can keep the sparse matrix sparse.

提交回复
热议问题