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

 
 

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

Submitter:  None
Submitted:  Thu 09 May 2013 10:44:10 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Michiel Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.2
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-22 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2013-07-27 mtmiller CategoryNone Octave Function
        Item GroupNone Incorrect Result
        StatusNone Patch Submitted
    2013-05-10 pantxo Attached File- Added ppval_nearest_shape.patch, #28060

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code