9

My question is rather simple : What is the difference between the numpy.linalg.inv and the scipy.linalg.inv functions for matrices inversion

Is the Scipy function just a wrapper of the Numpy one ? Efficiency, numerical stability, speed ... which one should I prefer ?

Thanks !

1 Answer 1

9

From the SciPy Documentation you get the following information:

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

I hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.