Numpy和Scipy矩阵求逆函数存在差异

Numpy and Scipy matrix inversion functions differences

我的问题很简单:矩阵求逆的numpy.linalg.invscipy.linalg.inv函数有什么区别

scipy函数只是numpy函数的包装吗?效率,数值稳定性,速度…我更喜欢哪一个?

谢谢!


从scipy文档中可以获得以下信息:

scipy.linalg vs numpy.linalg
scipy.linalg contains all the functions in numpy.linalg. plus some other more advanced ones not contained in numpy.linalg
Another advantage of using scipy.linalg over numpy.linalg is that it is always compiled with BLAS/LAPACK support, while for numpy this is optional. Therefore, the scipy version might be faster depending on how numpy was installed.

Therefore, unless you don’t want to add scipy as a dependency to your numpy program, use scipy.linalg instead of numpy.linalg

希望这有帮助!