Bicubic spline gridded 2d interpolation
C = gpuSplin2d(x,y,z[,spline_type])
Strictly increasing row vector (with at least 2 components) defining the interpolation grid.
Can be :
Real vector stored in device memory (GPU).
Real vector stored in host memory (CPU).
nx x ny matrix (nx being the length of x and ny the length of y)
This parameter can be stored in host memory (CPU) or in device memory (GPU).
String selecting the kind of bicubic spline to compute. (optional)
A vector with the coefficients of the bicubic patches.
C is stored on device memory (GPU)
gpuSplin2d
performs the same operation as Scilab function splin2d.
The spline_type argument is the same as the Scilab function splin2d.
// interpolation of cos(x)cos(y) n = 7; // a regular grid with n x n interpolation points // will be used x = linspace(0,2*%pi,n); y = x; z = cos(x')*cos(y); m = 50; // discretisation parameter of the evaluation grid xx = linspace(0,2*%pi,m); yy = xx; [XX,YY] = ndgrid(xx,yy); // host splin2d C = splin2d(x, y, z, "periodic"); zz = interp2d(XX,YY, x, y, C); emax = max(abs(zz - cos(xx')*cos(yy))); // device splin2d dC = gpuSplin2d(x, y, z, "periodic"); CC = gpuGetData(dC); clear dC; zzz = interp2d(XX,YY, x, y, CC); gemax = max(abs(zzz - cos(xx')*cos(yy))); // display host result clf(); plot3d(xx, yy, zz, flag=[2 4 4]); a=gca(); [X,Y] = ndgrid(x,y); param3d1(X,Y,list(z,-9*ones(1,n)), flag=[0 0]); str = msprintf(" with %d x %d interpolation points. ermax = %g",n,n,emax); xtitle("Host spline interpolation of cos(x)cos(y)"+str); // display device result scf(1); plot3d(xx, yy, zzz, flag=[2 4 4]); a=gca(); [X,Y] = ndgrid(x,y); param3d1(X,Y,list(z,-9*ones(1,n)), flag=[0 0]); str = msprintf(" %d x %d interpolation points. ermax = %g",n,n,gemax); xtitle("Device spline interpolation of cos(x)cos(y)\n"+str); | ![]() | ![]() |