help-octave
[Top][All Lists]
Advanced

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

Re: Evaluating a series


From: Sergei Steshenko
Subject: Re: Evaluating a series
Date: Thu, 9 Aug 2012 08:36:07 -0700 (PDT)




----- Original Message -----
> From: Jordi Gutiérrez Hermoso <address@hidden>
> To: Nicholas Jankowski <address@hidden>
> Cc: Octave users list <address@hidden>
> Sent: Thursday, August 9, 2012 6:27 PM
> Subject: Re: Evaluating a series
> 
> On 9 August 2012 10:45, Nicholas Jankowski <address@hidden> wrote:
>>  hah... yeah, thought that would get someone up in arms. it would be
>>  bigger, uglier, slower, BUT more intelligible and educational to a
>>  programming newbie.
> 
> For this particular problem, the loopless code is more succinct and
> easier to understand.
> 
> And nothing wrong to teach people from the beginning to avoid loopless
> code. That's how it was taught to me, and I think I came out alright.
> 
> - Jordi G. H.


Actually, it _is_ wrong to teach people from the beginning loopless code - 
because it's much easier for the people being taught to miss the fact that

for n = 1:N
  for m = 1:M
    ...
  endfor
endfor

nested loops have O(N * M) computational complexity.

Regards,
  Sergei.


reply via email to

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