Interpolation Overview

FastInterpolations.jl provides four interpolation methods with increasing smoothness. All methods support analytical 1st and 2nd derivatives.

MethodContinuity1st Derivative2nd Derivative
ConstantC⁻¹ (discontinuous)00
LinearC⁰ (continuous)Piecewise constant0
QuadraticC¹ (smooth)ContinuousPiecewise constant
CubicC² (smooth)ContinuousContinuous

Grid Types

All interpolation methods support both uniform and non-uniform grids, but performance differs:

Grid TypeLookup ComplexityRecommendation
AbstractRangeO(1) (Direct)Best for uniform grids
AbstractVectorO(log n) (Binary Search)Use only for non-uniform data
Performance Guide

For details on minimizing allocations and choosing the right grid, see Performance Tips.


API Selection

To balance convenience and maximum performance, three API patterns are available:

  • One-shot: For dynamic data or simple scripts.
  • Interpolant: For static lookups (pre-computed).
  • SeriesInterpolant: For handling multiple series efficiently (10-120× faster scalar queries).
Selection Guide

Not sure which one to use? Check the API Selection Guide.


Next Steps