|
High-performance radial basis function interpolation |
Also known as: meshfree methods, meshless methods, RBF-FD (Radial Basis Function Finite Differences), scattered data interpolation, kernel methods, polyharmonic splines, collocation methods
- Truly Meshless - Work directly with scattered points, no mesh generation required
- GPU Ready - Seamless CPU/GPU execution via KernelAbstractions.jl
- Flexible Operators - Built-in Laplacian, gradient, partial derivatives, or define your own custom operators
- Boundary Conditions - Hermite interpolation for Dirichlet, Neumann, and Robin BCs in PDE applications
- Local Collocation - k-nearest neighbor stencils for scalable large-domain problems
- Differentiable - AD-compatible via ChainRulesCore and Mooncake extensions
Scattered data points (left) reconstructed as a smooth surface using RBF interpolation (right)
using RadialBasisFunctions, StaticArrays
# Create scattered 2D points
points = [SVector{2}(rand(2)) for _ in 1:500]
f(x) = sin(4x[1]) * cos(3x[2])
values = f.(points)
# Interpolation - evaluate anywhere in the domain
interp = Interpolator(points, values)
interp(SVector(0.5, 0.5))
# Differential operators - apply to scattered data
lap = laplacian(points) # Laplacian operator
grad = gradient(points) # Gradient operator
∂x = partial(points, 1, 1) # ∂/∂x₁
lap_values = lap(values) # Apply Laplacian to data
grad_values = grad(values) # Returns Nx2 matrix of gradients| Type | Formula | Best For |
|---|---|---|
| Polyharmonic Spline (PHS) |
|
General purpose, no shape parameter tuning needed |
| Inverse Multiquadric (IMQ) | Smooth interpolation with tunable accuracy | |
| Gaussian | Infinitely smooth functions |
All basis functions support polynomial augmentation (enabled by default) for enhanced accuracy.
# Basis function examples
basis = PHS(3) # Cubic PHS (default: quadratic polynomial augmentation)
basis = PHS(5; poly_deg=3) # Quintic PHS with cubic polynomials
basis = IMQ(1.0) # IMQ with shape parameter ε=1.0
basis = Gaussian(0.5) # Gaussian with shape parameter ε=0.5using Pkg
Pkg.add("RadialBasisFunctions")Requires Julia 1.10 or later.
Handle boundary conditions properly with Hermite interpolation:
# Build operator with boundary awareness
lap = laplacian(points, eval_points, PHS(3), k,
boundary_nodes, boundary_conditions, normals)Operators automatically leverage GPU when data is on device:
using CUDA
points_gpu = cu(points)
lap_gpu = laplacian(points_gpu) # Weights computed on GPUDefine any differential operator using automatic differentiation:
# Example: custom operator
my_op = custom(points, basis -> (x, xc) -> your_derivative_function(basis, x, xc))- Getting Started - Tutorials and examples
- Theory - Mathematical background on RBF methods
- API Reference - Full function documentation
If you use RadialBasisFunctions.jl in your research, please cite:
@software{RadialBasisFunctions_jl,
author = {Beggs, Kyle},
title = {RadialBasisFunctions.jl: Meshless RBF interpolation and differential operators for Julia},
url = {https://github.com/JuliaMeshless/RadialBasisFunctions.jl},
doi = {10.5281/zenodo.7941390}
}Contributions are welcome! Please feel free to:
- Report bugs or request features on GitHub Issues
- Start a discussion on GitHub Discussions
- Submit pull requests
Part of the JuliaMeshless organization.
