bugGNU Octave - Bugs: bug #43735, function interp1 behaves...

 
 

bug #43735: function interp1 behaves incorrectly

Submitter:  None
Submitted:  Mon 01 Dec 2014 11:28:18 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 05 Dec 2014 07:08:51 PM UTC, comment #5: 

I applied Nir's patch to the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/ef649fe230f5).  The fix will be part of any 3.8.3 bug fix release, but it is more likely that the next release will be 4.0 which will include it.  For an immediate fix the reporter can use the interp1.m file attached to this report.

Rik <rik5>
Group administrator
Tue 02 Dec 2014 04:49:54 PM UTC, comment #4: 

The small attached patch fixes it. I also added these as tests.

(file #32584, file #32585)

Nir Krakauer <nir_krakauer>
Tue 02 Dec 2014 03:26:47 PM UTC, comment #3: 

Thanks for testing.  Marking this issue as confirmed.

Rik <rik5>
Group administrator
Tue 02 Dec 2014 06:29:40 AM UTC, comment #2: 

Hi,

Using MATLAB R2010a:


 interp1([0,1],[1,0],[0.1,0.9;0.2,1.1])

ans =

    0.9000    0.1000
    0.8000       NaN

 interp1([0,1],[1,0],[0.1,0.9;0.2,1.0])

ans =

    0.9000    0.1000
    0.8000         0


Avinoam

Avinoam Kalma <avinoam>
Group Member
Tue 02 Dec 2014 03:45:02 AM UTC, comment #1: 

The result does look odd.  Could someone run the example code in Matlab and report the results?

Rik <rik5>
Group administrator
Mon 01 Dec 2014 11:28:18 PM UTC, original submission:  

When using octave version 3.8.2 interp1 results gives following results:


octave:1> interp1([0,1],[1,0],[0.1,0.9;0.2,1.1])
ans =

   0.90000   0.10000
   0.80000  -0.10000
   0.00000   0.00000
        NA        NA

octave:2>
octave:2> interp1([0,1],[1,0],[0.1,0.9;0.2,1.0])
ans =

   0.90000   0.10000
   0.80000   0.00000


Expected behaviour should be (in my opinion and as with version 3.4.3 and also 3.6.*)


octave:1> interp1([0,1],[1,0],[0.1,0.9;0.2,1.1])
ans =

   0.90000   0.10000
   0.80000        NA

octave:2> interp1([0,1],[1,0],[0.1,0.9;0.2,1.0])
ans =

   0.90000   0.10000
   0.80000   0.00000


I think that the bug is somewhere in file interp1.m:336. As yi is reshaped in each method and not in the end of interp1 as previously yi(outliers, :) = extrap will mess up yi because outliers and yi have different dimensions.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #32584:  interp1.m added by nir_krakauer (29KiB - text/x-objcsrc)
file #32585:  interp1.patch added by nir_krakauer (908B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nir_krakauer (Updated the item)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-05 rik5 Item GroupIncorrect Result Regression
        StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-12-02 nir_krakauer Attached File- Added interp1.m, #32584
        Attached File- Added interp1.patch, #32585
    2014-12-02 rik5 StatusNeed Info Confirmed
    2014-12-02 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code