votca 2024.2-dev
Loading...
Searching...
No Matches
votca::tools::AkimaSpline Class Reference

An Akima Spline Class. More...

#include <akimaspline.h>

Inheritance diagram for votca::tools::AkimaSpline:
Collaboration diagram for votca::tools::AkimaSpline:

Public Member Functions

 AkimaSpline ()=default
 
 ~AkimaSpline () override=default
 
double getSlope (double m1, double m2, double m3, double m4)
 Calculate the slope according to the original Akima paper ("A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures")
 
void Interpolate (const Eigen::VectorXd &x, const Eigen::VectorXd &y) override
 Calculate interpolating spline for given (x,y) values. Points on resulting spline can be obtained via Calculate().
 
void Fit (const Eigen::VectorXd &x, const Eigen::VectorXd &y) override
 Fit spline through noisy (x,y) values. Points on resulting fitted spline can be obtained via Calculate().
 
double Calculate (double r) override
 Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()
 
double CalculateDerivative (double r) override
 Calculate y value for a given x value on the derivative of the spline created by function Interpolate or Fit.
 
Eigen::VectorXd Calculate (const Eigen::VectorXd &x)
 Calculate spline function values for given x values on the spline created by Interpolate() or Fit()
 
Eigen::VectorXd CalculateDerivative (const Eigen::VectorXd &x)
 Calculate y values for given x values on the derivative of the spline created by function Interpolate or Fit.
 
- Public Member Functions inherited from votca::tools::Spline
 Spline ()=default
 
virtual ~Spline ()=default
 
void setBC (eBoundary bc)
 Set the boundary type of the spline.
 
void setBCInt (Index bc)
 Set the boundary type of the spline.
 
double getGridPoint (int i)
 Get the grid point of certain index.
 
Eigen::VectorXd Calculate (const Eigen::VectorXd &x)
 Calculate spline function values for given x values on the spline created by Interpolate() or Fit()
 
Eigen::VectorXd CalculateDerivative (const Eigen::VectorXd &x)
 Calculate y values for given x values on the derivative of the spline created by function Interpolate or Fit.
 
void Print (std::ostream &out, double interval)
 Print spline values (using Calculate()) on output "out" on the entire grid in steps of "interval".
 
Index getInterval (double r)
 Determine the index of the interval containing value r.
 
Index GenerateGrid (double min, double max, double h)
 Generate the grid for fitting from "min" to "max" in steps of "h".
 
Eigen::VectorXd & getX ()
 Get the grid array x.
 
const Eigen::VectorXd & getX () const
 

Protected Attributes

Eigen::VectorXd p0
 
Eigen::VectorXd p1
 
Eigen::VectorXd p2
 
Eigen::VectorXd p3
 
Eigen::VectorXd t
 
- Protected Attributes inherited from votca::tools::Spline
eBoundary boundaries_ = eBoundary::splineNormal
 Get the spline data f_.
 
Eigen::VectorXd r_
 

Additional Inherited Members

- Public Types inherited from votca::tools::Spline
enum  eBoundary { splineNormal = 0 , splinePeriodic = 1 , splineDerivativeZero = 2 }
 enum for type of boundary condition More...
 

Detailed Description

An Akima Spline Class.

does Akima interpolation based on the paper "A new method of interpolation and smooth curve fitting based on local procedures"

Fitting is not supported. In order to fit data, do linear fitting and interpolate the linear fitted values by Akima interpolation.

Definition at line 44 of file akimaspline.h.

Constructor & Destructor Documentation

◆ AkimaSpline()

votca::tools::AkimaSpline::AkimaSpline ( )
default

◆ ~AkimaSpline()

votca::tools::AkimaSpline::~AkimaSpline ( )
overridedefault

Member Function Documentation

◆ Calculate() [1/2]

Eigen::VectorXd votca::tools::Spline::Calculate ( const Eigen::VectorXd & x)

Calculate spline function values for given x values on the spline created by Interpolate() or Fit()

Parameters
xvector of data values
Returns
vector of y value

Definition at line 116 of file spline.cc.

◆ Calculate() [2/2]

double votca::tools::AkimaSpline::Calculate ( double x)
overridevirtual

Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()

Parameters
xdata value
Returns
y value

Implements votca::tools::Spline.

Definition at line 161 of file akimaspline.cc.

◆ CalculateDerivative() [1/2]

Eigen::VectorXd votca::tools::Spline::CalculateDerivative ( const Eigen::VectorXd & x)

Calculate y values for given x values on the derivative of the spline created by function Interpolate or Fit.

Parameters
xvector of data values
Returns
vector of y value

Definition at line 124 of file spline.cc.

◆ CalculateDerivative() [2/2]

double votca::tools::AkimaSpline::CalculateDerivative ( double x)
overridevirtual

Calculate y value for a given x value on the derivative of the spline created by function Interpolate or Fit.

Parameters
xdata value
Returns
y value of derivative

Implements votca::tools::Spline.

Definition at line 168 of file akimaspline.cc.

◆ Fit()

void votca::tools::AkimaSpline::Fit ( const Eigen::VectorXd & x,
const Eigen::VectorXd & y )
overridevirtual

Fit spline through noisy (x,y) values. Points on resulting fitted spline can be obtained via Calculate().

Parameters
xvalues of data to be fitted
yvalues of data to be fitted both vectors must be of same size

Implements votca::tools::Spline.

Definition at line 157 of file akimaspline.cc.

◆ getSlope()

double votca::tools::AkimaSpline::getSlope ( double m1,
double m2,
double m3,
double m4 )

Calculate the slope according to the original Akima paper ("A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures")

Parameters
m1slope of the first line segment connecting the five data points
m2slope of the second line segment connecting the five data points
m3slope of the third line segment connecting the five data points
m4slope of the fourth line segment connecting the five data points
Returns
slope handles all special cases to determine the slope based on slopes m1,m2,m3,m4

Definition at line 174 of file akimaspline.cc.

◆ Interpolate()

void votca::tools::AkimaSpline::Interpolate ( const Eigen::VectorXd & x,
const Eigen::VectorXd & y )
overridevirtual

Calculate interpolating spline for given (x,y) values. Points on resulting spline can be obtained via Calculate().

Parameters
xvalues of data to be interpolated
yvalues of data to be interpolated both vectors must be of same size

Implements votca::tools::Spline.

Definition at line 30 of file akimaspline.cc.

Member Data Documentation

◆ p0

Eigen::VectorXd votca::tools::AkimaSpline::p0
protected

Definition at line 88 of file akimaspline.h.

◆ p1

Eigen::VectorXd votca::tools::AkimaSpline::p1
protected

Definition at line 89 of file akimaspline.h.

◆ p2

Eigen::VectorXd votca::tools::AkimaSpline::p2
protected

Definition at line 90 of file akimaspline.h.

◆ p3

Eigen::VectorXd votca::tools::AkimaSpline::p3
protected

Definition at line 91 of file akimaspline.h.

◆ t

Eigen::VectorXd votca::tools::AkimaSpline::t
protected

Definition at line 92 of file akimaspline.h.


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