[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: polyfit hangs on inf input
From: |
Jaroslav Hajek |
Subject: |
Re: polyfit hangs on inf input |
Date: |
Mon, 3 Nov 2008 21:28:33 +0100 |
On Mon, Nov 3, 2008 at 9:05 PM, Dmitri A. Sergatskov
<address@hidden> wrote:
> On Mon, Nov 3, 2008 at 12:32 PM, Søren Hauberg <address@hidden> wrote:
>> man, 03 11 2008 kl. 12:11 -0600, skrev Dmitri A. Sergatskov:
>>> The following code seems to hang octave 3.0.2 (on Fedora 9 x86_64):
>>>
>>> xx=linspace(-1,1,11);
>>> yy=2*linspace(-1,1,11);
>>> xx(6)=Inf;
>>> polyfit(xx',yy',1)
>>>
>>> The problem seems to be with underlying x\y code.
>>> I do not know WWMD in this case, but hanging does not
>>> seem to be appropriate. Either bailing out with an error,
>>> or ignoring with a warning seem to be better options.
>>
>> With 3.1.51+ I get
>>
>> octave:4> polyfit(xx',yy',1)
>> ans =
>>
>> NaN NaN
>
> This appears to be the (unintended?) result of the code:
>
> if (nargout > 2)
> ## Normalized the x values.
> mu = [mean(x), std(x)];
> x = (x - mu(1)) / mu(2);
> endif
>
> (std(x) returns NaN if x has Infs)
>
> x\y would still hang.
>
Can you please extract the precise values of x and y for which x\y hangs?
> Anyone can check what would matlab do in
> either case?
>
>>
>> Søren
>>
>>
>
> Dmitri.
> --
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz