This is a great program! It is easy to use, and is really impressively fast.
I was using it for 3D and 4D interpolation of rather large problems, and was taking hours per image to process. I found that I could offload much of the problem to the GPUs, and get an order of magnitude more speed with a couple of lines of extra code! It's a bit sloppy, but putting y = gpuArray(y) near the beginning of the cdtn() and icdtn() functions bought me this performance enhancement. There are likely more efficient and elegant ways of sending it to the GPU, though this way worked great in a pinch. Small problems (including the example problem) run a bit slower with this modification, so this really is for large problems only.
This function normalizes the output, which I did not want. Commenting out the last line in the script took care of that (the program is only 10 or 15 lines long). After that, this generated output that is identical to the native conv() function, and did it orders of magnitude faster. Thanks! =)
Works fast and well! However, it has a HUGE learning curve if you don't write code at a very high level...the included examples I found to be less than completely understandable to me, and don't work unless you know how to use them. Instead, here is a VERY SIMPLE program that uses this algorithm to fit a function to a simulated dataset. I took it and modified it from a forum post elsewhere on the internets. Recall that chi^2 = sum(((x - mu)/sigma).^2), and the point of this function is to determine what parameters in mu minimize chi^2:
% Ender 2008-07-08
a = 10, b = -8, c = -.2 %Model parameters
t = (0:.01:1)'; %should be a column vector
data = a + b*(1-exp(t/c)) + .1*randn(size(t)); %Function plus random error; simulates data
res = @(x) data - (x(1) + x(2)*(1-exp(t/x(3))) ); %Numerator of chi^2, with quantity squared implied for fitting in LMFnlsq; also known as residuals
x0 = [5,3,-.1]; %rather poor initial guess of parameters
[x,ssq,cnt] = LMFnlsq(res,x0) %Returns the parameter values which minimized the value of the numerator
%Plot the data
plot(t,(x(1) + x(2)*(1-exp(t/x(3)))),'r'), grid