help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error in interp2 argument processing/checking?


From: Eric S Fraga
Subject: error in interp2 argument processing/checking?
Date: Sun, 13 Jul 2008 00:29:54 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

I may be wrong (often highly likely ;-) but I've been using interp2
(on Debian Lenny, up to date as of yesterday, Octave version 3.0.1).
It seems to me that there is an inconsistency in the expectations of
the method's arguments depending on what type of interpolation is
required.  

Specifically, if the first two arguments, X and Y, are vectors, the
check to see if they are of the right size is different depending on
the order of interpolation (linear vs cubic).  The 'cubic' case seems
wrong (to me).

Attached is a "diff -c" output for a version I have modified to get it
to work (and it does work).  Please ignore the change in function name
(made to allow for easier testing).  Also please excuse me if this
went to the wrong list but it's the only list I subscribe to.

Thanks,
eric

*** /usr/share/octave/3.0.1/m/general/interp2.m 2008-05-25 20:50:24.000000000 
+0100
--- hg/mesh/twod/src/octave/interp2esf.m        2008-07-12 23:33:50.000000000 
+0100
***************
*** 88,94 ****
  ##       "meshgridded") to be consistent with the help message
  ##       above and for compatibility.
  
! function ZI = interp2 (varargin)
    Z = X = Y = XI = YI = n = [];
    method = "linear";
    extrapval = NA;
--- 88,94 ----
  ##       "meshgridded") to be consistent with the help message
  ##       above and for compatibility.
  
! function ZI = interp2esf (varargin)
    Z = X = Y = XI = YI = n = [];
    method = "linear";
    extrapval = NA;
***************
*** 243,249 ****
      if (isvector (X) && isvector (Y))
        X = X(:).';
        Y = Y(:);
!       if (!isequal ([length(X), length(Y)], size(Z)))
        error ("X and Y size must match Z dimensions");
        endif
      elseif (!size_equal (X, Y))
--- 243,249 ----
      if (isvector (X) && isvector (Y))
        X = X(:).';
        Y = Y(:);
!       if (!isequal ([length(Y), length(X)], size(Z)))
        error ("X and Y size must match Z dimensions");
        endif
      elseif (!size_equal (X, Y))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]