bugGNU Octave - Bugs: bug #36351, interp2 run from high to low

 
 

bug #36351: interp2 run from high to low

Submitter:  Grant Stephens <stephensg>
Submitted:  Mon 30 Apr 2012 12:46:15 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 09 May 2012 03:43:41 AM UTC, comment #6: 

It seems like the issue is fixed. I'm closing this report.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 03 May 2012 10:37:53 PM UTC, comment #5: 

I pushed a modification of the changeset.

http://hg.savannah.gnu.org/hgweb/octave/rev/0d37fda09415

Ben Abbott <bpabbott>
Group Member
Thu 03 May 2012 12:31:27 PM UTC, comment #4: 

You are right, Matlab does not handle non-monotonic, too. So, your patch is correct to fix the bug, even if a more intelligent error message can be give.
Later I could try to handle the non-monotonic case.
But please push your patch to fix this bug.

Cheers,

Marco

Marco Caliari <caliari>
Group Member
Thu 03 May 2012 11:38:06 AM UTC, comment #3: 

Good point on handling non-monotonic values.

Matlab will throw an error if x and/or y are not monotonic (i.e. all (diff (x) > 0) || all (diff (x) < 0))

My thought was to do the same ... although I now realize a more intelligent error message can be give.

Did you have something else in mind ?

Ben Abbott <bpabbott>
Group Member
Thu 03 May 2012 06:55:36 AM UTC, comment #2: 

Dear Ben,

does your path manage the case


x = [0,-1,1];
[xx yy] = meshgrid(x);


that is, non-monotonic x? I didn't try, but I don't think so. Since in bicubic.m there is already a sort of x and xi (around line 113), I think that a proper fix should first of all sort x (not sure about xi).

Marco

Marco Caliari <caliari>
Group Member
Thu 03 May 2012 12:21:53 AM UTC, comment #1: 

I've attached a changeset. If there are no concerns/comments, I'll push it.

(file #25769)

Ben Abbott <bpabbott>
Group Member
Mon 30 Apr 2012 12:46:15 PM UTC, original submission:  

The interp2 function does not work with meshgrid data that is arranged from high to low, as follows:

x=linspace(1,-1,10);
[xx yy] = meshgrid (x);
z = cos(2*pi*xx)+sin(2*pi*yy);
x=linspace(1,-1,30);
[xx2 yy2] = meshgrid (x);
z2 = interp2 (xx,yy,z,xx2,yy2,'cubic');


It does run in matlab and should be able to run in octave with minimal changes.

Grant Stephens <stephensg>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25769:  changeset.patch added by bpabbott (3KiB - application/octet-stream)
file #25768:  changeset.patch added by bpabbott (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by bpabbott (Updated the item)
  • -email is unavailable- added by stephensg (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-05-09 jordigh StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2012-05-03 bpabbott StatusPatch Submitted Ready For Test
    2012-05-03 bpabbott Attached File- Added changeset.patch, #25769
        Item GroupOther Matlab Compatibility
        StatusNone Patch Submitted
        Assigned toNone bpabbott
    2012-05-03 bpabbott Attached File- Added changeset.patch, #25768
    2012-04-30 stephensg Carbon-CopyRemoved -email is unavailable- -
    2012-04-30 stephensg Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code