bugGNU Octave - Bugs: bug #30121, interpn.m & __interpn_lin__.m...

 
 

bug #30121: interpn.m & __interpn_lin__.m problem

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Sat 12 Jun 2010 10:21:22 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * 3.2.4 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 26 Jul 2010 11:38:18 AM UTC, comment #7: 

Philip,

Thanks for looking over the change. I've pushed the changeset and am closing the ticket.

Ben

Ben Abbott <bpabbott>
Group Member
Mon 26 Jul 2010 08:06:17 AM UTC, comment #6: 

Ben,

For me the demos work too now. I'd say this bug has been fixed.

Thanks, Philip

Philip Nienhuis <philipnienhuis>
Group Member
Sun 18 Jul 2010 01:41:57 AM UTC, comment #5: 

Philip,

Thanks for catching the demos (which I some how managed to overlook).

I've make a second attempt at the changeset and have attached it to the tracker.

Ben

(file #20997)

Ben Abbott <bpabbott>
Group Member
Sat 17 Jul 2010 09:04:49 PM UTC, comment #4: 

Hi Ben,

AFAICS at this moment, interpn.m works OK now in the code I was using after swapping your fixed version into share/octave/m/3.2.4/general, many thanks.

However, some nitty-gritty about the demos (sorry)

(1) I saw that demo1 still has the typo I already reported ("AI" where it should read "yi" in line 4).

(2) demo2 still crashes, but slightly differently:

octave-3.2.4.exe:1> A=[13,-1,12;5,4,3;1,6,2];
octave-3.2.4.exe:2> x=[0,1,4]; y=[10,11,12];
octave-3.2.4.exe:3> xi=linspace(min(x),max(x),17);
octave-3.2.4.exe:4>  yi=linspace(min(y),max(y),26)';
octave-3.2.4.exe:5> mesh(xi,yi,interpn(x,y,A.',xi,yi,"nearest").')
error: operator -: nonconformant arguments (op1 is 442x1, op2 is 1x442)
error: called from:
error:   C:\Programs\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interpn.m at line 160, column 15
error: evaluating argument list element number 3
error: evaluating argument list element number 1

Philip Nienhuis <philipnienhuis>
Group Member
Fri 16 Jul 2010 01:36:03 PM UTC, comment #3: 

I've attached a proposed fix to the tracker.

Philip, please let us know if this solves your problems.

(file #20992)

Ben Abbott <bpabbott>
Group Member
Fri 16 Jul 2010 12:31:53 AM UTC, comment #2: 

Philip,

The variable "tnum" is missing from interpn.mat.

octave:166> clear all
octave:167> load ("interpn.mat")
octave:168> whos
Variables in the current scope:

  Attr Name        Size                     Bytes  Class
  ==== ====        ====                     =====  =====
       Phi        26x9x51                   95472  double
       dd2        26x9x5                     9360  double
       rm          1x9                         72  double
       t           1x5                         40  double
       zm         26x1                        208  double

Total is 13144 elements using 105152 bytes

Can you tell us what it is?

Ben Abbott <bpabbott>
Group Member
Thu 01 Jul 2010 04:21:12 AM UTC, comment #1: 

This is confirmed on a recent hg tip (10736:14af8004945d) running on a GNU/Linux system.

Rik <rik5>
Group administrator
Sat 12 Jun 2010 10:21:22 PM UTC, original submission:  

interpn.m (& _interpn_lin_.cc) fail to operate properly in octave-3.2.4 (MingW build / Windows). It also fails in a self-compiled octave-3.2.4 under MandrivaLinux.
It worked properly in octave-3.0.3 (VC build / Windows).
FWIW, the examples below work OK in ML.

Attached .mat file contains some test data that help to show the error.

octave-3.2.4.exe:2> load interpn.mat
octave-3.2.4.exe:3> whos
Variables in the current scope:

  Attr Name         Size                     Bytes  Class
  ==== ====         ====                     =====  =====
       Phi         26x9x51                   95472  double
       ans          1x11                        92  cell
       dd2          9x26x5                    9360  double
       dirlist      1x6                         18  cell
       ii           1x1                          8  double
       rm           1x9                         72  double
       t            1x5                         40  double
       tnum         1x51                       408  double
       zm          26x1                        208  double

Total is 13213 elements using 105678 bytes

octave-3.2.4.exe:4> dd2 = interpn (rm, zm, tnum, Phi, rm, zm, t)
error: interpn: incompatible size of argument number 6
error: called from:
error:   C:\Programs\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interpn.m at line 141, column 8
octave-3.2.4.exe:4>


In addition, interpn.m has a typo in line 5 of the first demo test: "AI=" should read "yi=".
But even after fixing this, interpn.m fails a number of demo tests:
---------------------------------------------
# DEMO 1
octave-3.2.4.exe:4> A=[13,-1,12;5,4,3;1,6,2];
octave-3.2.4.exe:5> x=[0,1,4]; y=[10,11,12];
octave-3.2.4.exe:6> xi=linspace(min(x),max(x),17);
octave-3.2.4.exe:7> yi=linspace(min(y),max(y),26)';      # Here yi was replaced by "AI"
octave-3.2.4.exe:8> mesh(xi,yi,interpn(x,y,A.',xi,yi,"linear").');
error: interpn: incompatible size of argument number 5
error: called from:
error:   C:\Programs\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interpn.m at line 141, colu
mn 8
error: evaluating argument list element number 3
error: evaluating argument list element number 1
octave-3.2.4.exe:8>

----------------------------------------
# DEMO 2
<all initialization commands (lines 1..4) are identical to DEMO 1 so only the call to interpn is shown:)
# .. init lines ....
octave-3.2.4.exe:9> mesh(xi,yi,interpn(x,y,A.',xi,yi,"nearest").');
error: operator -: nonconformant arguments (op1 is 17x1, op2 is 1x17)
error: called from:
error:   C:\Programs\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interpn.m at line 152, colu
mn 15
error: evaluating argument list element number 3
error: evaluating argument list element number 1
octave-3.2.4.exe:9>

-----------------------------------------
# DEMO 3
# .. init lines ....
octave-3.2.4.exe:9> mesh(xi,yi,interpn(x,y,A.',xi,yi,"cubic").')
error: cubic interpolation not yet implemented
error: called from:
error:   C:\Programs\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interpn.m at line 190, colu
mn 5
error: evaluating argument list element number 3
error: evaluating argument list element number 1
octave-3.2.4.exe:9>
# Note: This one performs as expected! as "cubic" is not implemented indeed

--------------------------------------------
# DEMO 4
# .. init lines ....
octave-3.2.4.exe:8> mesh(xi,yi,interpn(x,y,A.',xi,yi,"spline").');
works OK and gives a nice 3D plot.

# DEMO 5
# .. works OK and gives plot similar to demo 4

For smaller-size test cases below the demo stanzas interpn.m seems to work OK (I haven tested them all)..

Philip Nienhuis <philipnienhuis>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #20997:  changeset.patch added by bpabbott (3KiB - application/octet-stream - 2nd attempt)
file #20992:  interpn.m added by bpabbott (9KiB - application/octet-stream - 1st attempt)
file #20740:  interpn.zip added by philipnienhuis (114KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-26 bpabbott StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2010-07-18 bpabbott Attached File- Added changeset.patch, #20997
    2010-07-16 bpabbott Attached File- Added interpn.m, #20992
        StatusConfirmed Ready For Test
        Assigned toNone bpabbott
    2010-07-01 rik5 StatusNone Confirmed
    2010-06-12 philipnienhuis Attached File- Added interpn.zip, #20740

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code