[SciPy-user] matrix inversion time (Python vs MATLAB)

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri Jan 9 12:52:09 EST 2009


zzzz wrote:
> Hi!
>
> I've made a direct comparison of the time numpy and MATLAB need to
> calculate inverse matrix. Since (as far as I know) both call standard
> packages such as LAPACK internally, I thought that for large matrices
> inversion time should be approximately the same. Contrary to my
> expectations, the difference between Python's numpy.linalg.inv and
> MATLAB actually diverge (with Python being approximately 6 times
> slower than MATLAB for matrices of size 1000).
>   

For such big matrices, you are testing your lapack implementation; at
this point, this has nothing to do with numpy or scipy, unless matlab
and scipy have the same lapack implementation - which is highly
unlikely. One order of magnitude of difference can easily be seen
between LAPACK implementations, specially for matrices/matrices
operations (BLAS level 3).

Which lapack are you using for numpy ?

David



More information about the SciPy-User mailing list