votca 2024-dev
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
votca::tools::LinSpline Class Reference

A Linear Spline Class. More...

#include <linspline.h>

Inheritance diagram for votca::tools::LinSpline:
Inheritance graph
[legend]
Collaboration diagram for votca::tools::LinSpline:
Collaboration graph
[legend]

Public Member Functions

 LinSpline ()=default
 
 ~LinSpline () override=default
 
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.
 
virtual double Calculate (double x)=0
 Calculate spline function value for a given x value on the spline created by 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()
 
virtual double CalculateDerivative (double x)=0
 Calculate y value for a given x value on the derivative of the spline created by function 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
 
virtual void Interpolate (const Eigen::VectorXd &x, const Eigen::VectorXd &y)=0
 Calculate interpolating spline for given (x,y) values. Points on resulting spline can be obtained via Calculate().
 
virtual void Fit (const Eigen::VectorXd &x, const Eigen::VectorXd &y)=0
 Fit spline through noisy (x,y) values. Points on resulting fitted spline can be obtained via Calculate().
 
virtual double Calculate (double x)=0
 Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()
 
virtual double CalculateDerivative (double x)=0
 Calculate y value for a given x value on the derivative of the spline created by function Interpolate or Fit.
 
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 a
 
Eigen::VectorXd b
 
- 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

A Linear Spline Class.

class supports linear interpolation and linear fit of data

Definition at line 34 of file linspline.h.

Constructor & Destructor Documentation

◆ LinSpline()

votca::tools::LinSpline::LinSpline ( )
default

◆ ~LinSpline()

votca::tools::LinSpline::~LinSpline ( )
overridedefault

Member Function Documentation

◆ Calculate() [1/3]

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/3]

double votca::tools::LinSpline::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 30 of file linspline.cc.

◆ Calculate() [3/3]

virtual double votca::tools::Spline::Calculate ( double  x)
virtual

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.

◆ CalculateDerivative() [1/3]

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/3]

double votca::tools::LinSpline::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 35 of file linspline.cc.

◆ CalculateDerivative() [3/3]

virtual double votca::tools::Spline::CalculateDerivative ( double  x)
virtual

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.

◆ Fit()

void votca::tools::LinSpline::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 80 of file linspline.cc.

◆ Interpolate()

void votca::tools::LinSpline::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 40 of file linspline.cc.

Member Data Documentation

◆ a

Eigen::VectorXd votca::tools::LinSpline::a
protected

Definition at line 63 of file linspline.h.

◆ b

Eigen::VectorXd votca::tools::LinSpline::b
protected

Definition at line 64 of file linspline.h.


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