Model or dataset
JuliaMath/Interpolations.jl avatar
JuliaMath/Interpolations.jl

Interpolations.jl: continuous interpolation of discrete data in Julia

Fast, continuous interpolation of discrete datasets in Julia

577 stars116 forksJuliaNOASSERTION

At a glance

What is it?
Interpolations.jl is a Julia package for B-splines and irregular grids, with an API built around binding an interpolation object to a grid and an array of values, optional extrapolation boundary conditions, and a performance shootout against SciPy's RegularGridInterpolator. The API is explicitly still allowed to evolve, and the licence is a custom one.
Who is it for?
Adopt Interpolations.jl if you interpolate gridded or scattered data in Julia and want B-spline support with gradients and optional extrapolation, particularly in a differentiable pipeline where the interpolation has to be part of an optimisation. Skip it if your data are strictly one dimensional with no derivatives needed, since several smaller packages in the ecosystem cover that, and skip it if you need a stable API, because the README says it may continue to evolve.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 10 days ago.
What is it written in?
Mainly Julia, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

One declaration produces an object you call like a function

Interpolations.jl implements a variety of interpolation schemes for the Julia language, with the goals of ease-of-use, broad algorithmic support and exceptional performance, and it installs like any registered Julia package.

julia
using Pkg
Pkg.add("Interpolations")

The usage model is the part that makes it feel like a Julia package rather than a numerical library ported from elsewhere. You create a grid and an array of values, hand both to an interpolation constructor, and get back an object you call with a position. The grid in the example is a range and the values are a broadcast of the logarithm, and the constructor is linear_interpolation.

julia
xs = 1:0.2:5
A = log.(xs)
julia
interp_linear = linear_interpolation(xs, A)
interp_linear(3) # exactly log(3)
interp_linear(3.1) # approximately log(3.1)
interp_linear(0.9) # outside grid: error

The three calls illustrate the contract. A point that lies exactly on a grid node returns the stored value, a point between nodes returns the interpolated value, and a point outside the grid is an error rather than a silent answer. That last behaviour is a deliberate design choice and it is the one most worth knowing before you use the library, because the alternative is the failure mode where an out-of-range query silently returns a plausible number. The object is callable, which means it composes with Julia's broadcast and with the automatic differentiation tooling, and the package's own performance shootout against SciPy's RegularGridInterpolator is the natural way to judge the claim about performance.

Extrapolation is opt-in and expressed as a boundary condition

If you do need values outside the grid, the way to get them is to name a boundary condition rather than to have the library guess, and the example shows the flag that enables it.

julia
interp_linear_extrap = linear_interpolation(xs, A,extrapolation_bc=Line()) 
interp_linear_extrap(0.9) # outside grid: linear extrapolation

The keyword is extrapolation_bc and the value here is Line, which extends the first and last segments of the interpolation beyond the grid. The naming is deliberate, because the general mechanism is a boundary condition, so the same slot would hold other choices, and a constant or a periodic condition are the kinds of thing that slot is shaped for. The subtlety is that extrapolation is never free of a modelling decision. Extending the end segment linearly assumes the function continues to behave locally like it did at the boundary, which is true for a smooth function sampled densely and false for one that turns over just outside your data. So the choice of boundary condition is a claim about the domain, and the library is right to make you state it.

B-splines, irregular grids, and Lanczos as the newest addition

The scope is stated in one paragraph. The package currently supports B-splines and also irregular grids, the API has been designed with intent to support more options, and initial support for Lanczos interpolation was recently added, with pull requests welcome. The README also warns that the API may continue to evolve over time, which is a candid statement that a pre-1.0 Julia package is exactly that. B-splines are the mathematically interesting part of the offering, because they give you a smooth interpolant with local support, which is what you want when you are interpolating a large grid and the cost of a global method would dominate. Locality also matters for the other reason that a global method gives you an interpolant that is sensitive to every data point, while a B-spline is not. Irregular grids matter for anyone whose data are scattered rather than laid out on a lattice, which is the common case in geophysics and spatial statistics. Lanczos interpolation arrives in a different category, since it is a resampling method for band-limited signals rather than a spline scheme, and it is the kind of thing you reach for when reconstructing a signal rather than smoothing a field.

The ecosystem list is the most useful part of the README

The longest section of the README is a list of other interpolation packages for Julia, and for anyone deciding whether Interpolations.jl is the right choice it is the most useful part of the document, because it maps the territory. ApproXD.jl implements B-spline and linear interpolation. BarycentricInterpolation.jl does the Barycentric formula for polynomial interpolation on equispaced points and on Chebyshev points of the first and second kind, which is the approach you want for scattered data in one dimension. PCHIPInterpolation.jl is for monotonic interpolation, and that is worth noting because monotonicity is a property a general spline does not give you and one that matters whenever the interpolated quantity is a count or a probability. NaturalNeighbours.jl handles scattered two dimensional point sets with derivative generation, and ScatteredInterpolation.jl does scattered data in arbitrary dimensions. KernelInterpolation.jl implements radial basis function methods in arbitrary dimensions with support for solving linear partial differential equations. FastInterpolations.jl covers fast multi dimensional splines of order zero to three on nonuniform Cartesian grids with optimized derivatives, integrals, Hessians and reverse-mode adjoints, which is the entry to look at if you need differentiation. GridInterpolations.jl does multivariate interpolation on a rectilinear grid, and the FinestShift.jl, FourierTools.jl and GeoStats.jl entries cover sub-sample shifting, sinc resampling and geostatistical simulation. The README is explicit that some of these support methods Interpolations does not, and invites a pull request if something is missing.

What the repository tree says about the implementation

The top level of the repository is a conventional Julia package layout, with a Project.toml, a NEWS.md for release notes, a CITATION.cff, a src/ directory for the implementation, an ext/ directory, test/ for the test suite, a doc/ and a docs/ directory, and a perf/ directory that holds the performance shootout script the README points at. The perf directory matters more than it sounds, because a claim about exceptional performance that is not accompanied by a script anyone can run is a claim, and this package ships the script. The shootout compares the interpolation methods the package implements with each other, and with SciPy's RegularGridInterpolator, which is the right comparison to publish because it is the reference point most Julia users already know and the one they would otherwise port from. The presence of an ext/ directory also suggests the package uses Julia's package extension mechanism, so optional dependencies can be loaded without being hard requirements, which keeps the base install light.

Where Interpolations.jl is the wrong choice

The first limit is that the whole package is about interpolating a value at a position inside a domain you have already sampled, and if your actual problem is fitting a model to noisy data rather than passing exactly through it, this is the wrong tool. The README makes that distinction implicitly with the list of alternatives, where DataInterpolations.jl, BasicInterpolators.jl, FastChebInterp.jl and the geo-statistical entries all cover different territory. The second is the one-dimensional case, where several smaller packages do the job with a smaller dependency footprint, and the README says so by listing them. The third is API stability, and the README is upfront that the API may continue to evolve, which is fine for a research package and awkward for a library other code depends on, particularly when the version numbers have not converged, with 0.15.2 dated later than 0.16.3 in the release list, so the tag ordering does not read as a simple ascending sequence. The fourth is the licence, where the project listing records a custom licence that GitHub cannot classify, so you need to read the LICENSE file rather than assume the permissive terms of a Julia package with an OSI identifier. The fifth is scope, since irregular grid and B-spline support is not the same as scattered data support in the general case, and the list of packages above exists precisely because that distinction matters.

Editorial conclusion

Adopt Interpolations.jl if you interpolate gridded or scattered data in Julia and want B-spline support with gradients and optional extrapolation, particularly in a differentiable pipeline where the interpolation has to be part of an optimisation. Skip it if your data are strictly one dimensional with no derivatives needed, since several smaller packages in the ecosystem cover that, and skip it if you need a stable API, because the README says it may continue to evolve. Verify first which Julia version you are on and which release of the package supports it, that the licence terms suit your use, and whether the extrapolation boundary condition you choose is one your data actually justify.

Frequently asked questions

How do I install Interpolations.jl and interpolate a simple dataset?

Install it with using Pkg followed by Pkg.add("Interpolations"), then create a grid and an array of values and pass both to linear_interpolation(xs, A). The result is callable, so interp_linear(3) returns the value at a grid node, interp_linear(3.1) interpolates between nodes, and a point outside the grid is an error unless you ask for extrapolation.

How do I get values outside the grid in Interpolations.jl?

Pass an extrapolation boundary condition to the constructor, for example linear_interpolation(xs, A, extrapolation_bc=Line()) for linear extrapolation. Without such a boundary condition, querying outside the grid is an error rather than a silently returned value.

Which interpolation methods does Interpolations.jl support?

The README states the package currently supports B-splines and also irregular grids, that the API was designed with intent to support more options, and that initial support for Lanczos interpolation was recently added. The README also lists many separate Julia packages covering methods this one does not, including PCHIPInterpolation.jl for monotonic interpolation and KernelInterpolation.jl for radial basis functions in arbitrary dimensions.

Official sources

  1. Issues
  2. JuliaMath/Interpolations.jl on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/juliamath-interpolations-jl.svg)](https://hysenlabs.com/projects/juliamath-interpolations-jl)

Was this useful?