Skip to content

C++ cubic spline library with not-a-knot end conditions and extrapolation

Notifications You must be signed in to change notification settings

TheMates/SplineNotAKnot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

SplineNotAKnot

C++ cubic spline library with not-a-knot end conditions and extrapolation

Piecewise cubic polynomial interpolation with not-a-knot boundray condition. Imitates MATLAB spline() function.

It it not super fast, but it gets the job done.

Utilizes Eigen library. https://gitlab.com/libeigen/eigen

Example

#include "SplineNaK.h"
...
void main()
{
    std::vector<double> x{0., 1., 3., 4.};
    std::vector<dobule> y{0., 0., 2., 2.};
    
    SplineNak::Spline s;
    s.setPoints(x,y);
    
    double ys = s(1.5);     //get interpolated value
    ys = s(5.2);            //extrapolated value
    
    ...
}

About

C++ cubic spline library with not-a-knot end conditions and extrapolation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages