[Numpy-discussion] Matlab vs. Python (Was: Re: [SciPy-Dev] Good-bye, sort of (John Hunter))

Joshua Holbrook josh.holbrook@gmail....
Sun Aug 15 22:26:35 CDT 2010


On Sun, Aug 15, 2010 at 5:53 PM,  <josef.pktd@gmail.com> wrote:
> On Sun, Aug 15, 2010 at 4:27 PM, Sturla Molden <sturla@molden.no> wrote:
>>
>>> Matlab also takes a copy if we create an array slice. It means for example
>>> that a wavelet transform written in Python will be O(n) with respect to
>>> memory, whereas it will be O(n log n) in Matlab.
>>
>> Other examples:
>>
>> A reshape will create a new array in Matlab. It will create a view in NumPy.
>>
>> A transpose will create a new array in Matlab and be O(m*n). A transpose
>> will just create a view in NumPy (i.e. reverse stride and shape
>> attributes) and be O(1).
>>
>> Matlab does not broadcast. We must explicitely match array shapes using
>> repmat, which by the way creates a new array.
>
> I agree broadcasting is one of my favorite features of numpy compared
> to any other array language I know
>
>>
>> NumPy allows arrays to be updated inplace. Matlab always creates a new
>> copy (Matlab arrays are immutable).
>
> inplace operation in matlab:
> http://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/
> not as fancy but improving
>
> matlab has JIT compiler
>
> also this for some mostly balanced arguments, I think,
> http://stackoverflow.com/questions/179904/what-is-matlab-good-for-why-is-it-so-used-by-universities-when-is-it-better-tha
>
> I don't have very large memory requirements, and I didn't do enough
> similar things in matlab and python to have experience with these
> differences.
>
> Josef
>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>

This bit from the SO answers:

> Something you have to realize about MATLAB is that it started off as a wrapper on Fortran
> libraries for linear algebra. For a long time, it had an attitude that "all the world is an array of
> doubles (floats)". As a language, it has grown very organically, an there are some flaws that
> are very much baked in, if you look at it just as a programming language.

rings very true to me. On the other hand:

> There is a large community of users that share numerical code

I have never really been satisfied with Matlab Central, vs. Pypi,
Github, Sourceforge, and all that. Then again, I've been spoiled by
the OSS community and have some pretty specific needs for MATLAB, so
maybe I'm missing something.

--Josh


More information about the NumPy-Discussion mailing list