octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #29601] bugs in cubic and spline interpolation

 From: Søren Hauberg Subject: [Octave-bug-tracker] [bug #29601] bugs in cubic and spline interpolation with interp2 Date: Sun, 04 Jul 2010 10:30:37 +0000 User-agent: Mozilla/5.0 (X11; U; Linux i686; da-DK; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6

```Follow-up Comment #3, bug #29601 (project octave):

Sorry about the late reply (the last half year has been crazy for me...). To
be honest I am not sure if I am the author of the code in question (I might
be; I just don't remember), but I'll do a review anyway :-)

- ## If X and Y vectors produce a grid from them
+ ## Check dimensions of X and Y
if (isvector (X) && isvector (Y))
X = X(:).';
Y = Y(:);

Seems like a reasonable change to me (the new comment is more descriptive).

- ## If Xi and Yi are vectors of different orientation build a grid
- if ((rows (XI) == 1 && columns (YI) == 1)
- || (columns (XI) == 1 && rows (YI) == 1))
- ## Do nothing
+ ## Check dimensions of XI and YI
+ if (isvector (XI) && isvector (YI))
+ XI = XI(:).';
+ YI = YI(:);

This seems simpler then the current code. I am not sure if the

+ XI = XI(:).';
+ YI = YI(:);

part is really needed, but I guess it is better to play it safe, so this
seems fine to me.

function b = isgriddata (X)
d1 = diff (X, 1, 1);
- d2 = diff (X, 1, 2);
- b = all (d1 (:) == 0) & all (d2 (:) == d2 (1));
+ b = all (d1 (:) == 0);
endfunction

This removes the check that the derivative of X is constant. I guess this is
not a requirement for X to be gridded (consider e.g. the output of 'meshgrid
(logspace (1, 10, 10))'). So, I think this change is fine as well.

In summary, I'd say check in the change.

_______________________________________________________

<http://savannah.gnu.org/bugs/?29601>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```