bugGNU Octave - Bugs: bug #38948, interp1 output has wrong order...

 
 

bug #38948: interp1 output has wrong order with 'nearest'

Submitted by:  None
Submitted on:  Thu 09 May 2013 10:44:10 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: MichielOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.2
Operating System: Microsoft Windows

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 22 Oct 2013 04:06:13 PM UTC, comment #3:

I applied the interp patch since Olaf inspected it and Mike agrees that it fixes the current problem without introducing new 'make check' errors. Closing report.

Rik <rik5>
Project Administrator
Sat 27 Jul 2013 09:40:49 PM UTC, comment #2:

The attached patch does fix the given problem and all tests for interp1 and ppval still pass. I'm also not pretending to understand ppval, so I can't comment any further.

Mike Miller <mtmiller>
Project Member
Fri 10 May 2013 11:42:00 AM UTC, comment #1:

Attached is a patch that fixes this issue. It should be noted that I did not try to understand the code in ppval (sorcerer's apprentice method). I just ensured that the shape of intermediate matrix (before final reshaping) was consistent between "nearest" and higher order methods.

(file #28060)

Pantxo Diribarne <pantxo>
Project Member
Thu 09 May 2013 10:44:10 AM UTC, original submission:

Hi,

I noticed strange behavior with interp1 in combination with 'nearest'.

x=[11:20']';
y=[1:10]';
interp1(x,y, x(2:end-1)+[0.5 -0.5], 'nearest')
ans =

3 7
2 6
4 8
3 7
5 9
4 8
6 10
5 9
Notice that the output is given in the first column instead of per row
I would expect:
ans =

3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
my current workaround is:
interp1(x,y, x(2:end-1)+[0.5 -0.5], 'nearest')(:), 2,8)'

Cheers,

Michiel

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #28060:  ppval_nearest_shape.patch added by pantxo (979B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by pantxo (Updated the item)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 22 Oct 2013 04:06:13 PM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Sat 27 Jul 2013 09:40:49 PM UTCmtmillerCategoryNone=>Octave Function
      Item GroupNone=>Incorrect Result
      StatusNone=>Patch Submitted
    Fri 10 May 2013 11:42:00 AM UTCpantxoAttached File-=>Added ppval_nearest_shape.patch, #28060

    Back to the top


    Powered by Savane 3.1-cleanup