|
From: Travis B. <td...@fa...> - 2005-10-10 20:53:47
|
All, Lately folks in my office have started inquiring about the possibility of porting some Matlab code to Python. They're mostly concerned about cost and scriptability, but they're worried that the resulting Python code would be very slow. The current Matlab version of the prime porting target takes about 2 hours to run start to finish.=20 So I'm looking to either run some tests to prove that Python can keep up or take someone else's results from similar tests and evangelize with those. I've googled "python vs. matlab" but most results seem to address differences in the sort of code one has to write to achieve the same ends, I'm interested in speed. Anyone have any links or ammunition for the fight? thanks, Travis --=20 Travis Brady td...@fa... --=20 http://www.fastmail.fm - Same, same, but different=85 |
|
From: Andrea G. <and...@ti...> - 2005-10-10 21:12:01
|
Hello Travis, I worked about 7 years with Matlab, but at the end I gave up and I switched to Python. This is mainly due to the fact that with new Matlab releases (starting from R14) it is almost impossible to build a distributable executable file. You can compile an application into an exe, but you have to distribute such big files that I gave up. Moreover, GUI capabilities of Python (wxPython) are much much (much)^Inf superior to Matlab ones. Regarding your question: > They're mostly concerned about > cost and scriptability, but they're worried that the resulting Python > code would be very slow. This much depends on how you use Matlab. If you use highly specialized mathematical routines, image processing, optimization routines and everything that involves large matrix computations (inversion, decomposition, system solving etc...), I would be in doubt on which software I would use. Loops, conditionals and friends are much much faster in Python than in Matlab, even using JIT acceleration. Both software have a fast learning curve (in my opinion). In case of large matrix computations, I would try to compare Matlab capabilities to Python Numeric/scipy. However, if you could specify a little bit more which use of Matlab you do, I can probably give some more advice (even if I am not an expert with Numeric/scipy, so my Python routines may have to be optimized by someone else ;-) ). HTH. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77 |
|
From: Chris B. <Chr...@no...> - 2005-10-11 05:10:43
|
Just to add a few other comments about Python vs. Matlab. Matlab strengths: Very complete numerical library that is "just there", well integated and documented. With Python, you can find most of the same functionality, but it's a bit scattered, different libas aren't compatible with each other, etc. The SciPy project is heloping this a lot, but it's really not there yet. Integrated plotting. Matplotlib has gone a long way to address this weakness for Python but it's only 2-d, etc. Python+NumPy strengths: Much better language: Better OO, more powerful flexible etc, etc, etc. Much wider library support for things other than numerical work. Everything from text processing, full featured GUIs to Web developoment, etc. Also a huge number of C and C++ libs have been wrapped, for everything from GIS work to image processing. Far more options for a full featured GUI. NumPy supports wider variety of data types, integer types, etc. Better support for arrays with more that 2 dimensions. I like the NumPy array syntax/style better: elementwise is default, Array Broadcasting---yeah! Indexing from 0 and slicing sytax end up being much cleaner: concatenate(a[a:b] + a [b:c]) = a ... it saves a lot of adding one, and checking the end cases. More options for optimizing code, from simple stuff like in place operators: multiply(a,b,a) to SciPy.weave to Pyrex, to boost. Easy ways to wrap exisiting code: SWIG, f2Py, etc. Open source and platform independent. Easier to create stand-alone appliations, and on ANY platfrom. Do you need more?? Can you tell which one I use all the time these days? And I was a major fan of MATLAB before I discovered Python. In short, I think Python+NumPy is inherently far supperior a developmet environment. The only thing is lacks is the clean integation and packaging that is often superior with comercial apps. That isn't a small issue. I haven't suggested Python to a few of my coleagues that use MATLAB for numerical prototyping. For the work they do, the extra effort to find out how to do what you need to do for Python is probably not worth it, from selecting a development environment, to docs, etc. Now that MPL is in pretty good shape, I'm almost ready to recomend a switch. I do think that if you do any develpment beyond simnple numerical prototyping, you're better off with Python. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception |
|
From: Jeff W. <js...@fa...> - 2005-10-10 21:18:57
|
Travis Brady wrote: >All, > >Lately folks in my office have started inquiring about the possibility >of porting some Matlab code to Python. They're mostly concerned about >cost and scriptability, but they're worried that the resulting Python >code would be very slow. The current Matlab version of the prime >porting target takes about 2 hours to run start to finish. > >So I'm looking to either run some tests to prove that Python can keep up >or take someone else's results from similar tests and evangelize with >those. >I've googled "python vs. matlab" but most results seem to address >differences in the sort of code one has to write to achieve the same >ends, I'm interested in speed. > >Anyone have any links or ammunition for the fight? > >thanks, >Travis > > Travis: There was a thread on this on Numpy-discussion a while back. Here's an excerpt: http://aspn.activestate.com/ASPN/Mail/Message/numpy-discussion/2396301 Bottom line is that if you link the atlas libs, Numeric or numarray is comparable to Matlab for linear algebra (matrix multiply and eigenvector computation). -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449 325 Broadway Web : http://www.cdc.noaa.gov/~jsw Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124 |
|
From: Vidar G. <vid...@37...> - 2005-10-10 21:43:07
|
===== Original message from Travis Brady | Mon, 10 Oct 2005: > I've googled "python vs. matlab" but most results seem to address > differences in the sort of code one has to write to achieve the same > ends, I'm interested in speed. there are one slide (page 18) in a presentation 'Python for Scientific Computing' by Eric Jones, which shows a comparison of vector multiplication speed between matlab and python. i think i found it here: http://www.python9.org/p9-jones.ppt unfortunately the above link is broken, and i've been unable to find these somewhere else. |
|
From: Vidar G. <vid...@37...> - 2005-10-10 21:47:03
|
===== Original message from Vidar Gundersen | Mon, 10 Oct 2005: > there are one slide (page 18) in a presentation 'Python for > Scientific Computing' by Eric Jones, which shows a comparison > of vector multiplication speed between matlab and python. i found another presentation using the same material: http://www.iwce.nanohub.org/python.htm http://www.iwce.nanohub.org/talks/python/python_talk1.pdf see pages 58-59. |