Theoretica
Mathematical Library
Loading...
Searching...
No Matches
theoretica::spline Class Reference

A natural cubic spline interpolation class. More...

#include <splines.h>

Public Member Functions

template<typename DataPoints = std::vector<vec2>>
 spline (const DataPoints &p)
 Construct the natural cubic spline interpolation from a vector of coordinate pairs.
 
template<typename Dataset1 , typename Dataset2 >
 spline (const Dataset1 &X, const Dataset2 &Y)
 Construct the natural cubic spline interpolation from the sets of x[i] and y[i] data points.
 
splineoperator= (const spline &other)
 Copy from another spline.
 
real operator() (real x) const
 Evaluate the natural cubic spline interpolation at a given point.
 
real deriv (real x) const
 Evaluate the derivative of the natural cubic spline interpolation at a given point.
 
auto begin ()
 Get an iterator to the first spline element.
 
auto end ()
 Get an iterator to one plus the last spline element.
 

Public Attributes

std::vector< spline_nodenodes
 The computed nodes of the natural cubic spline interpolation over the points.
 

Detailed Description

A natural cubic spline interpolation class.

Constructor & Destructor Documentation

◆ spline() [1/2]

template<typename DataPoints = std::vector<vec2>>
theoretica::spline::spline ( const DataPoints &  p)
inline

Construct the natural cubic spline interpolation from a vector of coordinate pairs.

The x[i] values must be strictly increasing, an error is raised otherwise.

◆ spline() [2/2]

template<typename Dataset1 , typename Dataset2 >
theoretica::spline::spline ( const Dataset1 &  X,
const Dataset2 &  Y 
)
inline

Construct the natural cubic spline interpolation from the sets of x[i] and y[i] data points.

The x[i] values must be strictly increasing, an error is raised otherwise.


The documentation for this class was generated from the following file: