After learning some Python functions for the purpose of Computer Vision in mind, I do tests on Matrix multiply, SVD and EIG of Python in comparison with Matlab and OpenBLAS+Lapack. In these tests, on my Windows 7 32 bits laptop, I use Python 3.2 with numpy-MKL, Matlab 2010b, OpenBLAS 1.0 and Lapack 3.4.1. All the matrices contain float numbers and each operation runs for 5 times, then the average time is recorded.

Python 3.2 | Matlab 2010b | OpenBLAS 1.0 + Lapack 3.4.1 | ||||||||

Matrix Size | Multiply | SVD | EIG | Multiply | SVD | EIG | Multiply | SVD | EIG | EIGD |

1000×1000 | 0.065 | 1.726 | 4.168 | 0.063 | 0.928 | 1.756 | 0.063 | 1.13 | 3.666 | 0.546 |

2000×2000 | 0.506 | 14.182 | 26.61 | 0.495 | 8.156 | 12.221 | 0.967 | 8.95 | 33.899 | 3.603 |

3000×3000 | 1.657 | 46.663 | 74.41 | 1.63 | 25.772 | 37.268 | 1.685 | 26.43 | 113.771 | 10.483 |

4000×4000 | 3.898 | 3.875 | 7.566 | 24.648 | ||||||

5000×5000 | 7.618 | 7.507 | 10.686 | |||||||

6000×6000 | 13.086 | 12.926 | 25.475 |

Again, Matlab is the winner, but between Python and C/C++, which is better for implementation algorithms which run fast on Matab? The EIG test with Lapack is slow because I used precompiled lapack’s .dll, so it used only one Core of the system.

Updated with new EIG results of OpenBLAS and Lapack: I used divide and conquer functions ssyevd_ of Lapack and got much better results on the column EIGD. Now the choices are OpenBLAS and Lapack.

May 10, 2012 at 2:45 am

Dir Sir,

There is any way to improve time computation in Matlab?

May 10, 2012 at 8:05 am

I have tested Matlab 2010b and Matlab 2012a on Windows 7 32 bit machine with matrix multiply, SVD, EIG and did not found any improvement. But some one said that on Linux 64 bit and Windows 64 bit, the computation of Matlab may be better. But I think on 32 bit machine, the speed of Matlab is good for me.