A 2D interpolation library compatible with GSL.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake/Modules
CMakeLists.txt Add GSL library directories to linker search path Sep 4, 2015
COPYING Update top-level documentation Aug 15, 2013
Doxyfile.in Use README file as Doxygen main page documentation Aug 15, 2013
README.md Mention that 2D interpolation is added to GSL 2.0 Nov 1, 2015
bicubic.c Add in bicubic interpolation code Oct 15, 2012
bilinear.c Give a more sensible implementation for derivxy in bilinear case Sep 17, 2013
interp2d.c Add interp functions without boundary checks Dec 31, 2013
interp2d.h Add interp functions without boundary checks Dec 31, 2013
interp2d.kdev4 initial project import from KDevelop Jan 22, 2012
interp2d_spline.c Update README to talk about spline interface Aug 16, 2013
interp2d_spline.h Update README to talk about spline interface Aug 16, 2013
test.c Add interp functions without boundary checks Dec 31, 2013

README.md

interp2d generalizes the GSL interpolation routines to 2D interpolation. It tries to stick to the workflow and interface of the GSL 1D interpolation as closely as possible (even in cases where the GSL way may not quite make sense). The library includes implementations of bilinear and bicubic interpolation schemes.

As of GSL 2.0, the code from interp2d (bilinear and bicubic interpolation) is part of the GSL itself. There is no need to use this library with GSL 2.x.

Just like the GSL interpolation functions, there are two interfaces to the code. You can use the low-level interface defined in interp2d.h, which does not store the data arrays that define the function being interpolated (so you have to store them yourself and pass them to every function call), or you can use the high-level interface in interp2d_spline.h, which does store the data arrays in the interp2d_spline object.

The typical workflow is

  1. create an interpolation object using interp2d_alloc() (low-level) or interp2d_spline_alloc() (high-level)
  2. initialize it using interp2d_init() or interp2d_spline_alloc()
  3. evaluate the interpolating function or its derivatives using interp2d_eval()/interp2d_spline_eval() or its counterparts, possibly many times
  4. free the memory using interp2d_free() or interp2d_spline_free()

If your code evaluates the interpolating function many times, it may benefit from using gsl_interp_accel objects, which are described in the GSL documentation.

interp2d uses CMake as its build system. Typically, to install a CMake-based project from source, from the directory containing CMakeLists.txt, run

cmake .
./make
./make install

All files are licensed under the GPL version 3 or any later version at your option.

Development of interp2d is hosted on the Github project page https://github.com/diazona/interp2d, which is where you should report bugs or offer suggestions for improvement if you would like to do so.