Class implementing a simple linear spline.
More...
#include <SplineFunction.h>
Class implementing a simple linear spline.
This class implements a simple linear spline function f(x) of one argument. It is used to model a function f(x) which is defined by a set of (x,y) pairs. The function is evaluated using linear interpolation between the provided (x,y) pairs.
Definition at line 20 of file SplineFunction.h.
◆ SplineFunction() [1/2]
thermalfist::SplineFunction::SplineFunction |
( |
| ) |
|
|
inline |
◆ SplineFunction() [2/2]
thermalfist::SplineFunction::SplineFunction |
( |
std::vector< double > | x, |
|
|
std::vector< double > | y ) |
|
inline |
Constructor which sets the data from the provided vectors.
- Parameters
-
x | A vector of x values. |
y | A vector of y values. Data must be sorted in non-descending order of x values. |
Definition at line 36 of file SplineFunction.h.
◆ add_val()
void thermalfist::SplineFunction::add_val |
( |
double | x, |
|
|
double | val ) |
|
inline |
Adds a new pair of x,y values.
- Parameters
-
x | The x-coordinate. |
val | The y-coordinate (function value at x). Adds a new (x,y) pair to the function. The function is sorted after adding the new value. |
Definition at line 52 of file SplineFunction.h.
◆ clear()
void thermalfist::SplineFunction::clear |
( |
| ) |
|
|
inline |
Clears all data and fills the function with a constant function f(x) = 0.
Definition at line 122 of file SplineFunction.h.
◆ clearall()
void thermalfist::SplineFunction::clearall |
( |
| ) |
|
|
inline |
◆ df()
double thermalfist::SplineFunction::df |
( |
double | arg | ) |
const |
|
inline |
Evaluates slope (derivative) at x = arg.
- Parameters
-
arg | The point at which to evaluate the derivative. |
- Returns
- The value of the derivative at x = arg. Evaluates the derivative of the function at x = arg using linear interpolation between the provided (x,y) pairs.
Definition at line 93 of file SplineFunction.h.
◆ f()
double thermalfist::SplineFunction::f |
( |
double | arg | ) |
const |
|
inline |
Evaluates interpolated function at x = arg.
- Parameters
-
arg | The point at which to evaluate the function. |
- Returns
- The value of the function at x = arg. Evaluates the function at x = arg using linear interpolation between the provided (x,y) pairs.
Definition at line 66 of file SplineFunction.h.
◆ fill()
void thermalfist::SplineFunction::fill |
( |
std::vector< double > | x, |
|
|
std::vector< double > | y ) |
|
inline |
Fill (x,y) pairs from provided vectors.
- Parameters
-
x | A vector of x values. |
y | A vector of y values. Data must be sorted in non-descending order of x values. |
Definition at line 144 of file SplineFunction.h.
◆ fsquare()
double thermalfist::SplineFunction::fsquare |
( |
double | arg | ) |
|
|
inline |
Evaluates f(arg)^2.
- Parameters
-
arg | The point at which to evaluate the function. |
- Returns
- The value of the function at x = arg squared. Evaluates the function at x = arg using linear interpolation between the provided (x,y) pairs and returns the square of the result.
Definition at line 113 of file SplineFunction.h.
◆ setConstant()
void thermalfist::SplineFunction::setConstant |
( |
double | val | ) |
|
|
inline |
Models constant f(x) == val function.
- Parameters
-
val | The value of the constant function. Clears all data and fills the function with a constant function f(x) = val. |
Definition at line 160 of file SplineFunction.h.
The documentation for this class was generated from the following file: