Project Status: Active - The project has reached a stable, usable state and is being actively developed. Linux Build Status Windows Build status

Simple interpolation functions designed to be used from C. There is essentially no R support in this package, save code designed to be used by the package's own testing. cinterpolate is designed to be used in package code only and modification for use outside of a package is not explicitly supported.


Despite being only C code, this package requires a fortran compiler because it uses LAPACK and BLAS.

After that, install with



#include <cinterpolate/cinterpolate.h>

Allocate an object to perform interpolation with. nx and x are the size and values of the function to be interpolated, while ny is the number of functions to be simultaneously (but independently) interpolateed and y is the values for these. If ny > 1, then the values of y are as an R matrix with nx rows and ny columns (the first nx values are the first function, the second nx are the second, and so on).

void *obj = cinterpolate_alloc(type, nx, ny, x, y);

With the interpolation function, an input value of xout and given some storage yout of length ny, determine f(xout) with

cinterpolate_eval(xout, obj, yout);

Once done the object must be freed with


Further package setup

Somewhere in the package you must include cinterpolate.c as

#include <cinterpolate/cinterpolate.h>

but this must be included only once or linking will fail. If you only use the interpolation in one place, you can use cinterpolate.c rather than cinterpolate.h. If you use interpolation in more than once place, I recommend a file src/cinterpolate.c containing

#include <cinterpolate/cinterpolate.c>

Be sure to include in your DESCRIPTION a line

LinkingTo: cinterpolate

cinterpolate takes advantage of BLAS for matrix multiplication, so you may need a Makevars that includes



See inst/example for a full example of using cinterpolate within a package


MIT + file LICENSE © Rich FitzJohn.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Try the cinterpolate package in your browser

Any scripts or data that you put into this service are public.

cinterpolate documentation built on May 2, 2019, 6:13 a.m.