Difference in Solve Time Between Solvers
This example shows the difference between the '\' and the 'normal' solver. The gist is use the '\' for accuracy or ill conditioned problems otherwise use 'normal' for speed. 'normal' is 2-3 times faster than '\' on this data set.
% setup some input points, output points, and noise
z = tanh(xx-3).*sin(2*pi/6*yy);
noise = (rand(size(xx))-0.5).*xx.*yy/30;
% setup the grid for lookup table
xGrid = linspace(0,6,600);
yGrid = linspace(0,6.6,1950);
gridPoints = {xGrid, yGrid};
% setup some difference in scale between the different dimensions/axes to
% just show the effectiveness of regularizeNd's capability of handling
% different scales in different dimensions.
% smoothness parameter. i.e. fit is weighted 1000 times greater than
'normal' Solver
zGrid1 = regularizeNd([xx(:), yy(:)], zNoise(:), gridPoints, smoothness);
toc;
Elapsed time is 7.420369 seconds.
% Note the above command is the same as
% zGrid = regularizeNd([xx(:), yy(:)], zNoise(:), gridPoints, smoothness, 'linear');
% zGrid = regularizeNd([xx(:), yy(:)], zNoise(:), gridPoints, smoothness, 'linear', 'normal');
'\' Solver
zGrid2 = regularizeNd([xx(:), yy(:)], zNoise(:), gridPoints, smoothness,'linear', '\');
toc;
Elapsed time is 19.911707 seconds.
% Copyright (c) 2016-2026 Jason Nicholson
% Licensed under the MIT License
% See LICENSE file in project root