Mercurial > hg > octave-lojdl
changeset 10326:ade59ae10e80
slight optimization in interp2
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 17 Feb 2010 08:19:06 +0100 |
parents | 8b3cfc1288e2 |
children | 76cf6dd20f1a |
files | scripts/ChangeLog scripts/general/interp2.m |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-02-17 Jaroslav Hajek <highegg@gmail.com> + + * general/interp2: Slightly optimize linear interpolation. + 2010-02-12 Jaroslav Hajek <highegg@gmail.com> * general/interp2: Remove debug stub.
--- a/scripts/general/interp2.m +++ b/scripts/general/interp2.m @@ -221,8 +221,8 @@ idx = sub2ind (size (a), yidx, xidx); ## scale XI, YI values to a 1-spaced grid - Xsc = (XI - X(xidx)) ./ (X(xidx + 1) - X(xidx)); - Ysc = (YI - Y(yidx)) ./ (Y(yidx + 1) - Y(yidx)); + Xsc = (XI - X(xidx)) ./ (diff (X)(xidx)); + Ysc = (YI - Y(yidx)) ./ (diff (Y)(yidx)); ## apply plane equation ZI = a(idx) + b(idx).*Xsc + c(idx).*Ysc + d(idx).*Xsc.*Ysc;