简体   繁体   English

Python中复杂稀疏线性代数的限制

[英]Limits on Complex Sparse Linear Algebra in Python

I am prototyping numerical algorithms for linear programming and matrix manipulation with very large (100,000 x 100,000) very sparse (0.01% fill) complex (a+b*i) matrices with symmetric structure and asymmetric values. 我正在为线性编程和矩阵处理的数值算法制作原型,该算法具有对称结构和非对称值的非常大(100,000 x 100,000)稀疏(0.01%填充)复杂(a + b * i)矩阵。 I have been happily using MATLAB for seven years, but have been receiving suggestions to switch to Python since it is open source. 我已经很高兴使用MATLAB七年了,但是由于它是开源的,因此一直在接受有关切换到Python的建议。

I understand that there are many different Python numeric packages available, but does Python have any limits for handling these types of matrices and solving linear optimization problems in real time at high speed? 我知道有很多不同的Python数字软件包可用,但是Python在处理这些类型的矩阵以及实时实时地解决线性优化问题方面是否有任何限制? Does Python have a sparse complex matrix solver comparable in speed to MATLAB's backslash A\\b operator? Python是否有一个速度与MATLAB的反斜杠A \\ b运算符相当的稀疏复杂矩阵求解器? (I have written Gaussian and LU codes, but A\\B is always at least 5 times faster than anything else that I have tried and scales linearly with matrix size.) (我已经写了高斯和LU代码,但是A \\ B总是比我尝试过的其他任何东西至少快5倍,并且可以随矩阵大小线性缩放。)

Probably your sparse solvers were slower than A\\b at least in part due to the interpreter overhead of MATLAB scripts. 也许您的稀疏求解器比A\\b慢,至少部分原因是因为MATLAB脚本的解释器开销大。 Internally MATLAB uses UMFPACK's multifrontal solver for LU() function and A\\b operator (see UMFPACK manual ). MATLAB内部使用UMFPACK的LU()函数和A\\b运算符的多面求解器(请参见UMFPACK手册 )。

You should try scipy.sparse package with scipy.sparse.linalg for the assortment of solvers available. 你应该尝试scipy.sparsescipy.sparse.linalg可用求解器的品种。 In particular, spsolve() function has an option to call UMFPACK routine instead of the builtin SuperLU solver. 特别是, spsolve()函数可以选择调用UMFPACK例程,而不是内置的SuperLU解算器。

... solving linear optimization problems in real time at high speed? ...高速实时解决线性优化问题?

Since you have time constraints you might want to consider iterative solvers instead of direct ones. 由于您有时间限制,因此您可能需要考虑使用迭代求解器而不是直接求解器。

You can get an idea of the performance of SuperLU implementation in spsolve and iterative solvers available in SciPy from another post on this site. 您可以从此站点上的另一篇文章中了解SciPy中可用的spsolve和迭代求解器中SuperLU实现的性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM