speed comparison of IDL, numPy, Matlab

Nathaniel Gray n8gray at caltech.edu.is.my.email.address
Tue Feb 6 08:58:50 CET 2001


Paul van Delst wrote:

> I've never used Python, and Matlab only once or twice, but what's with the
> Python syntax? Seems a tad wordy. Looks like Nick Bower's IDL-like package
> in Python (http://nickbower.com/computer/pydl) is worth another look
> though......

It's true that Numpy code can end up more verbose than Matlab, although 
this example doesn't really hilight that issue.  This is to be expected 
from a language that wasn't designed from the ground up as a numerical 
computing language.  There's a faint glimmer of hope that we may get a new 
Python operator for matrix multiplication, though.  (See PEP 211)

On the flipside, have you ever tried to write user interfaces in Matlab?  
Have you ever tried to implement a dictionary in Matlab?  Have you ever 
tried to understand when Matlab is making a copy of a giant array and when 
it's using a reference?  Have you ever had your Matlab license expire the 
day of a meeting, _before_ you've made your plots?  

I have.  <shudder>

Having used IDL and Matlab quite extensively, I've realized that in any 
moderately complex numerical program 75% of the code is *programming* and 
only 25% of the code is *numerical*.  I'd take a great general-purpose 
language with decent numerical extensions over a decent language with great 
numerical capabilities any day of the week, and twice on Sunday. :^)

> paulv
> 
> P.S. BTW, in Matlab, how do you simply multiply the corresponding matrix
> elements? (i.e. not a matrix multiply).

mat1 .* mat2;

-n8

-- 
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._
             Nathaniel Gray
   California Institute of Technology
     Computation and Neural Systems
     n8gray <at> caltech <dot> edu
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._




More information about the Python-list mailing list