help-octave
[Top][All Lists]
Advanced

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

Re: is a piece of code in 'polyval' really needed ?


From: Ben Abbott
Subject: Re: is a piece of code in 'polyval' really needed ?
Date: Thu, 18 Aug 2011 12:49:50 -0400

On Aug 18, 2011, at 11:31 AM, Sergei Steshenko wrote:

> Hello,
> 
> looking at 'polyval' implementation in octave-3.4.2 I see this:
> 
> <snip>
> 
> Is this:
> 
>      65   if (length (p) == 0)
>      66     y = p;
>      67     return;
>      68   endif
> 
> really needed ? My point is that, if I understand correctly,
> 
>      52   if (! (isvector (p) || isempty (p)))
> 
> check won't let code on lines ##65 .. 68 to be executed.
> 
> 'polyval' is a ubiquitous function, so it should be as fast as
> possible - if the 'if' in question is unneeded, it makes the
> function slower for no good reason.
> 
> And shouldn't 'polyval' because of this be implemented in
> C++ ?
> 
> Thanks,
>   Sergei.

You are correct. Lines 65-68 aren't needed.

If you'd like to provide a patch let us know. Otherwise I'll delete these lines 
from polyval.m.

Ben



reply via email to

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