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
|
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)..
|