help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:


From: Francesco Potorti`
Subject: Re:
Date: Mon, 27 Mar 2006 10:19:57 +0200

>I think this is a real-world problem. It is probably the biggest flaw in 
>the matlab language, making you write programs which use unintuitive and 
>hard to understand tricks just to avoid for-loops. As a real world 
>example, have a look at the code for hist.m in octave. Instead of a ~N 
>for-loop, it uses NlogN sorting just because sort is done in C and thus 
>is faster.

I don't really think that this is a flaw.  The Octave (Matlab) language
is a matrix language, which is duly optimised for doing matrix
computations.  This is exactly what one would expect from a matrix
language.  Being fast at doing non-matrix operations is certainly an
added benefit, not the foremost objective of the language.

Do you agree?

>I think that for-loops are an essential part of any programming 
>language, and avoiding them has unfortunately become the hallmark of 
>good matlab programming. When conducting job interviews for positions 
>for which matlab/octave is relevant, one of my questions is:
>
>how would you calculate a 10 sample running average on a 100 element vector?

I wouldn't say that using a for loop for such a small vector is wrong,
unless the operation is to be done many times.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 313 8091
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]