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: Sergei Steshenko
Subject: Re: is a piece of code in 'polyval' really needed ?
Date: Thu, 18 Aug 2011 10:07:00 -0700 (PDT)




----- Original Message -----
> From: Ben Abbott <address@hidden>
> To: Sergei Steshenko <address@hidden>
> Cc: "address@hidden" <address@hidden>
> Sent: Thursday, August 18, 2011 7:49 PM
> Subject: Re: is a piece of code in 'polyval' really needed ?
> 
> 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
>

Attached is the patch and the whole modified file.

Regards,
  Sergei.

Attachment: polyval.m.diff-original-new
Description: Binary data

Attachment: polyval.m
Description: Binary data


reply via email to

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