Python 3.x 如何使用Numba加速scipy.sparse.linalg中提供的Python稀疏线性系统解算器?

Python 3.x 如何使用Numba加速scipy.sparse.linalg中提供的Python稀疏线性系统解算器?,python-3.x,scipy,sparse-matrix,solver,numba,Python 3.x,Scipy,Sparse Matrix,Solver,Numba,我希望使用Numba加快代码中稀疏系统解算器部分的速度。以下是我到目前为止的情况: # Both numba and numba-scipy packages are installed. I am using PyCharm IDE import numba import numba_scipy # import other required stuff @numba.jit(nopython=True) def solve_using_numba(A, b): return sp.

我希望使用Numba加快代码中稀疏系统解算器部分的速度。以下是我到目前为止的情况:

# Both numba and numba-scipy packages are installed. I am using PyCharm IDE
import numba
import numba_scipy
# import other required stuff

@numba.jit(nopython=True)
def solve_using_numba(A, b):
    return sp.linalg.gmres(A, b)

# total = the number of points in the system

A = sp.lil_matrix((total, total), dtype=float)
# populate A with appropriate data
A = A.tocsc()

b = np.zeros((total, 1), dtype=float)
# populate b with appropriate data

y, exit_code = solve_using_numba(A, b)

# plot solution
这就产生了错误

argument 0: cannot determine Numba type of <class 'scipy.sparse.csc.csc_matrix'>   
参数0:无法确定
在中,
numba-scipy扩展了numba以使其了解scipy。
但在这里,numba似乎无法使用scipy稀疏矩阵类。我哪里出了问题?我能做些什么来解决这个问题


我只需要加速代码中的稀疏系统解决方案部分,因为其他内容非常轻量级,比如获取两个用户输入,构造a和b矩阵,和绘制最终结果。

快速浏览和
numba_scipy
表明它只添加了对
scipy.special
子模块的支持。这看起来是一个非常新的(实验性的)添加。所以基本上numba不适合稀疏矩阵?我知道的所有解算器都是用C实现的。numba不会做任何事情来提高已经用C编写的代码的性能。即使稀疏矩阵是有效的numba类型,这也无关紧要。