Path: news.mathworks.com!not-for-mail
From: "Aurelien Stalder" <aurelien.stalder.remove@uniklinik-freiburg.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorizing interp2 for use in 3D arrays?
Date: Thu, 23 Aug 2007 10:28:38 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fajngm$dhr$1@fred.mathworks.com>
References: <f93kfr$ppb$1@fred.mathworks.com> <f9sdak$oci$1@fred.mathworks.com> <f9sqfn$rpb$1@fred.mathworks.com> <fahepe$bil$1@fred.mathworks.com> <fahvsb$ku5$1@fred.mathworks.com>
Reply-To: "Aurelien Stalder" <aurelien.stalder.remove@uniklinik-freiburg.de>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187864918 13883 172.30.248.37 (23 Aug 2007 10:28:38 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 23 Aug 2007 10:28:38 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1080281
Xref: news.mathworks.com comp.soft-sys.matlab:425161


"John D'Errico" <woodchips@rochester.rr.com> wrote in
message <fahk4p$64l$1@fred.mathworks.com>...
> A 3-d tensor product linear interpolant is mathematically
> equivalent to a linear interpolation applied to a pair of
> 2-d tensor product linear interpolants.
> 
> That equivalence should also apply to nearest neighbor
> interpolants.

Exact! The mathematical results are identical for those low
order interpolation methods and for any interpolation method
based on a separable filter. Nevertheless, the computation
algorithms (and hence computation time) are intrinsically
different between 1D, 2D, 3D or nD interpolation methods.

Generally, if you don't need interpolation in the 3rd
dimension, you should use successive 2D interpolation (as
Lorenzo initially suggested). Depending on the interpolation
implementation, the matrix size and other aspects, you may
find exceptions to this. As "us" demonstrated, when working
on a volume of size 5x7x15, interp3 can be faster than
interp2 in a loop.

Aurelien