sablib
Loading...
Searching...
No Matches
sablib::CubicSpline< Scalar > Class Template Referencefinal

A class for cubic spline interpolation. More...

#include <cubic_spline.h>

Public Member Functions

 CubicSpline ()=default
 Default constructor.
 CubicSpline (const Eigen::VectorX< Scalar > &x, const Eigen::VectorX< Scalar > &y)
 Constructor that fits a cubic spline to the given data points.
void Fit (const Eigen::VectorX< Scalar > &x, const Eigen::VectorX< Scalar > &y)
 Fits a cubic spline to the given data points.
Scalar Interpolate (const double x) const
 Interpolates the value at a given x-coordinate.
Scalar operator() (const double x) const
 Interpolates the value at a given x-coordinate.

Detailed Description

template<typename Scalar>
class sablib::CubicSpline< Scalar >

A class for cubic spline interpolation.

Template Parameters
ScalarThe scalar type for the spline (e.g., double, float).

Definition at line 23 of file cubic_spline.h.

Constructor & Destructor Documentation

◆ CubicSpline()

template<typename Scalar>
sablib::CubicSpline< Scalar >::CubicSpline ( const Eigen::VectorX< Scalar > & x,
const Eigen::VectorX< Scalar > & y )
inline

Constructor that fits a cubic spline to the given data points.

Parameters
xThe x-coordinates of the data points.
yThe y-coordinates of the data points.

Definition at line 92 of file cubic_spline.h.

References Fit().

Member Function Documentation

◆ Fit()

template<typename Scalar>
void sablib::CubicSpline< Scalar >::Fit ( const Eigen::VectorX< Scalar > & x,
const Eigen::VectorX< Scalar > & y )

Fits a cubic spline to the given data points.

Parameters
xThe x-coordinates of the data points.
yThe y-coordinates of the data points.
Exceptions
std::invalid_argumentThrown if x and y sizes differ, if size < 2, or if x is not strictly increasing.

Definition at line 101 of file cubic_spline.h.

Referenced by CubicSpline().

◆ Interpolate()

template<typename Scalar>
Scalar sablib::CubicSpline< Scalar >::Interpolate ( const double x) const

Interpolates the value at a given x-coordinate.

Parameters
xThe x-coordinate to interpolate.
Returns
The interpolated value at x.

Definition at line 188 of file cubic_spline.h.

Referenced by sablib::BaselineSpline(), and operator()().

◆ operator()()

template<typename Scalar>
Scalar sablib::CubicSpline< Scalar >::operator() ( const double x) const
inline

Interpolates the value at a given x-coordinate.

Parameters
xThe x-coordinate to interpolate.
Returns
The interpolated value at x.

Definition at line 64 of file cubic_spline.h.

References Interpolate().


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