Skip to content

JuliaMeshless/RadialBasisFunctions.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

414 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RadialBasisFunctions.jl

RadialBasisFunctions.jl

High-performance radial basis function interpolation
and differential operators for Julia.

Stable Docs Dev Docs Build Status codecov License DOI


Why RadialBasisFunctions.jl?

RBF methods approximate functions from scattered data without requiring a mesh. This package focuses on local collocation — building stencils from k-nearest neighbors instead of coupling all N points — so it scales to large problems without dense N×N solves.

Beyond interpolation, it provides differential operators (Laplacian, gradient, partials, custom) that act directly on scattered data, with support for Hermite interpolation to enforce boundary conditions in PDE applications.

Other things that might matter to you:

RBF Interpolation Demo

Scattered data points (left) reconstructed as a smooth surface using RBF interpolation (right)

Quick Start

using RadialBasisFunctions, StaticArrays

# Scattered 2D points — no mesh needed
points = [SVector{2}(rand(2)) for _ in 1:500]
f(x) = sin(4x[1]) * cos(3x[2])
values = f.(points)

# Interpolation
interp = Interpolator(points, values)
interp(SVector(0.5, 0.5))

# Differential operators on scattered data
∇²  = laplacian(points)
∇   = gradient(points)
∂x  = partial(points, 1, 1)       # ∂/∂x₁
∂²y = partial(points, 2, 2)       # ∂²/∂x₂²

∇²(values)                         # apply to data
(values)                          # Nx2 matrix

# Combine operators
mixed = ∂x + ∂²y                   # operator algebra

# Transfer data between point sets
target = [SVector{2}(rand(2)) for _ in 1:1000]
rg = regrid(points, target)
rg(values)                         # interpolated onto target

Supported Radial Basis Functions

Type Formula Best For
Polyharmonic Spline (PHS) $r^n$ where $n = 1, 3, 5, 7$ General purpose, no shape parameter tuning
Inverse Multiquadric (IMQ) $1 / \sqrt{(\varepsilon r)^2 + 1}$ Smooth interpolation with tunable accuracy
Gaussian $e^{-(\varepsilon r)^2}$ Infinitely smooth functions

Installation

using Pkg
Pkg.add("RadialBasisFunctions")

Requires Julia 1.10 or later.

Tip

The examples above use sensible defaults (PHS(3) basis, quadratic polynomial augmentation, auto-selected stencil size). All of these are configurable — see the Getting Started guide for details on choosing a basis function, stencil size (k), polynomial degree, Hermite boundary conditions, and more.

Documentation

  • Getting Started — tutorials covering interpolation, operators, and boundary conditions
  • Autodiff — differentiating through operators with Enzyme and Mooncake
  • Theory — mathematical background on RBF methods
  • API Reference — full function documentation

Citation

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}
}

Contributing

Contributions are welcome! Please feel free to:

Part of the JuliaMeshless organization.

About

Radial Basis Functions in Julia

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages