Mercurial > hg > octave-terminal
changeset 10328:2210d3070543
further memory optimization in interp2
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 17 Feb 2010 08:43:53 +0100 |
parents | 76cf6dd20f1a |
children | 83fa590b8a09 |
files | scripts/general/interp2.m |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/interp2.m +++ b/scripts/general/interp2.m @@ -218,12 +218,15 @@ c = Z(2:zr, 1:(zc - 1)) - a; d = Z(2:zr, 2:zc) - a - b - c; - idx = sub2ind (size (a), yidx, xidx); - ## scale XI, YI values to a 1-spaced grid Xsc = (XI - X(xidx)) ./ (diff (X)(xidx)); Ysc = (YI - Y(yidx)) ./ (diff (Y)(yidx)); + ## Get 2D index. + idx = sub2ind (size (a), yidx, xidx); + ## We can dispose of the 1D indices at this point to save memory. + clear xidx yidx + ## apply plane equation ZI = a(idx) + b(idx).*Xsc + c(idx).*Ysc + d(idx).*Xsc.*Ysc;