Numpy 和 Scipy 矩阵求逆函数的区别

Numpy and Scipy matrix inversion functions differences

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

Scipy 函数只是 Numpy 函数的包装器吗? 效率、数值稳定性、速度……我应该更喜欢哪一个?

谢谢!

您从 the SciPy Documentation 获得以下信息:

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

希望对您有所帮助!