3D Linear Interpolation for GPU
Updated 5 Aug 2014
This function is faster than MATLAB's griddedInterpolant function for the CPU, but slower than MATLAB's interpn function for the GPU. However, I've coded this using arrayfun. Since MATLAB does not support using interpn in arrayfun, this function should be helpful to those who wish to do interpolation inside more complex code executing on the GPU using arrayfun. I tried making this code as fast as possible, but I cannot match the speed of interpn. Any suggestions for improvements would be greatly appreciated.
Note that this function assumes the data to be interpolated does not go off the grid and the grid is uniformly spaced in each dimension. The syntax is exactly like interpn, i.e.
should produce the same result. If your data are gpuArrays, then interp3gpu will execute on your GPU. Otherwise it will execute on your CPU.
Philip (2023). 3D Linear Interpolation for GPU (https://www.mathworks.com/matlabcentral/fileexchange/47437-3d-linear-interpolation-for-gpu), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- MATLAB > Mathematics > Interpolation >
- Parallel Computing > Parallel Computing Toolbox > GPU Computing >
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.