octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #35174] polyfit broken by chageset 61450538517

 From: marco atzeri Subject: [Octave-bug-tracker] [bug #35174] polyfit broken by chageset 614505385171 Date: Mon, 26 Dec 2011 07:36:19 +0000 User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

```URL:
<http://savannah.gnu.org/bugs/?35174>

Summary: polyfit broken by chageset 614505385171
Project: GNU Octave
Submitted by: matzeri
Submitted on: Mon 26 Dec 2011 07:36:18 AM GMT
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any

_______________________________________________________

Details:

changeset 14104:614505385171
doc: Overhaul docstrings for polynomial functions.

has the side effect to broke a test inside polyfit.

isrow can not work as it is applied after y=y(:)
so this portion should be reversed

10.30
10.31 -  y_is_row_vector = (rows (y) == 1);
10.32 -
10.33    ## Reshape x & y into column vectors.
10.34    l = numel (x);
10.35    x = x(:);
10.36 @@ -98,7 +97,7 @@
10.37    if (nargout > 1)
10.38      yf = v*p;
10.39
10.40 -    if (y_is_row_vector)
10.41 +    if (isrow (y))
10.42        s.yf = yf.';
10.43      else
10.44        s.yf = yf;

>>>>> processing /pub/hg/octave/scripts/polynomial/polyfit.m
***** test
x = 1000 + (-5:5);
xn = (x - mean (x)) / std (x);
pn = ones (1,5);
y = polyval (pn, xn);
[p, s, mu] = polyfit (x, y, numel(pn)-1);
[p2, s2] = polyfit (x, y, numel(pn)-1);
assert (p, pn, s.normr)
assert (s.yf, y, s.normr)
assert (mu, [mean(x), std(x)])
assert (s.normr/s2.normr < sqrt(eps))
!!!!! test failed
assert (s.yf,y,s.normr) expected
Columns 1 through 8:
3.50419    1.60995    0.84300    0.67356    0.77025    1.00000    1.42810
2.31817
Columns 9 through 11:
4.13221    7.53054   13.37184
but got
3.50419
1.60995
0.84300
0.67356
0.77025
1.00000
1.42810
2.31817
4.13221
7.53054
13.37184
Dimensions don't match

_______________________________________________________

<http://savannah.gnu.org/bugs/?35174>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```