The EZspline Toolbox is a free open source MEX-based Toolbox for MATLAB(R)
that does quick interpolation of
1D, 2D & 3D points, clouds and grids. For the most part, it's a
MATLAB(R) port of the EZspline Fortran 90 interface by Alex Pletzer.
The computational routines used are from the
PSPLINE Fortran module library from the National Transport Code
Collaboration (NTCC) developed at the Princeton Plasma Physics Laboratory
(PPPL) by
Doug McCune.
Like the original EZspline interface, NetCDF is a
supported data format; MATLAB(R)'s binary MAT data format is available as
well.
Runtimes and errors are compared below between the EZspline Toolbox and
MATLAB's Spline Toolbox v. 3.2. The test was run with a P4 1.8 GHz, 1 Gb RAM,
Lahey/Fujitsu Opt. F95 compiler and MATLAB 6.5.1.
Here's what the test looks like
(ezspline_time.m).
Source Code: ezsplinetoolbox-0.0.tar.gz
Binary Distribution: ezsplinetoolbox-0.0-lx-i386.tar.gz
(Skip: steps 2-4 below; make 'all'
in step 5)
Alternatively, the latest version can be checked out through
anonymous (pserver) CVS with the following instruction set. When prompted
for a password for anonymous, simply press the Enter key.
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ezsplinetoolbox login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ezsplinetoolbox co ezsplinetoolbox-0.0
tar -zxvf ezsplinetoolbox-0.0.tar.gz
make 'all' make 'install' make 'clean'
addpath('/home/rsz/ezspline/bin');
cd test ezspline_testOnly errors will produce output.
nx = 31; xmin = 0; xmax = 1; x = linspace(xmin, xmax, nx); f = x.^3; % compute the spline coefficients [ez, ier] = ezspline_setup(f, [[0 0]]); % single point & interp P = [.1111]; [V, ier] = ezspline_interp(ez, P); % array of points & interp P = [.1111,.2222,.3333]; [V, ier] = ezspline_interp(ez, P'); % optional - check if grid is strictly increasing ier = ezspline_isgridreg(ez); % optional - check if point is in domain P = [.111, .111]; ier = ezspline_isindom(ez, P);
nx = 31; xmin = 0; xmax = 1; ny = 41; ymin = 0; ymax = 1; x = linspace(xmin, xmax, nx); y = linspace(ymin, ymax, ny); [xx, yy] = ndgrid(x,y); f = xx.^3 + 2 * yy.^3; % compute the spline coefficients [ez, ier] = ezspline_setup(f, [[0 0], [0 0]]); % single point & interp P = [.1111, .1111]; [V, ier] = ezspline_interp(ez, P); % cloud of points & interp P = [.1111,.1111; .2222 .2222; .3333 .3333]; [V, ier] = ezspline_interp(ez, P); % array of points & interp P1 = .1111: .1111 : .3333; P2 = P1; [V, ier] = ezspline_interp(ez, P1, P2); % optional - check if grid is strictly increasing ier = ezspline_isgridreg(ez); % optional - check if point is in domain P = [.111, .111]; ier = ezspline_isindom(ez, P);
nx = 31; xmin = 0; xmax = 1; ny = 41; ymin = 0; ymax = 1; nz = 5; zmin = 0; zmax = 1; x = linspace(xmin, xmax, nx); y = linspace(ymin, ymax, ny); z = linspace(zmin, zmax, nz); [xx, yy, zz] = ndgrid(x,y,z); f = xx.^3 + 2 * yy.^3 + 3 * zz.^3; % compute the spline coefficients [ez, ier] = ezspline_setup(f, [[0 0], [0 0], [0 0]]); % single point & interp P = [.1111, .1111, .1111]; [V, ier] = ezspline_interp(ez, P); % cloud of points & interp P = [.1111, .1111, .1111; .2222, .2222, .2222]; [V, ier] = ezspline_interp(ez, P); % array of points & interp P1 = .1111: .1111 : .3333; P2 = P1; P3 = P1; [V, ier] = ezspline_interp(ez, P1, P2, P3); % optional - check if grid is strictly increasing ier = ezspline_isgridreg(ez); % optional - check if point is in domain P = [.111, .111, .111]; ier = ezspline_isindom(ez, P);
% save with NetCDF format ier = ezspline_save(ez, 'file.nc'); % load with NetCDF format ez = ezspline_load('file.nc'); % save with MATLAB MAT format ier = ezspline_save(ez, 'file.mat', 'mat'); % load with MATLAB MAT format ez = ezspline_load('file.mat', 'mat');