This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at possibly nonuniform points. More...
#include <NonuniformTableLinear.hpp>
Public Member Functions | |
NonuniformTableLinear () | |
Default constructor. | |
NonuniformTableLinear (const std::vector< double > &x_values, const std::vector< T > &y_values) | |
Construct from vectors of x and y values. More... | |
NonuniformTableLinear (const TableColumn &x_column, const std::vector< T > &y_values) | |
NonuniformTableLinear (const TableColumn &x_column, const TableColumn &y_column) | |
std::pair< double, double > | domain () |
Get the domain. More... | |
void | rescaleDomain (std::pair< double, double > new_domain) |
Rescale the domain. More... | |
double | operator() (const double x) const |
Evaluate the value at x. More... | |
double | derivative (const double x) const |
Evaluate the derivative at x. More... | |
double | inverse (const double y) const |
Evaluate the inverse at y. More... | |
bool | operator== (const NonuniformTableLinear &other) const |
Equality operator. More... | |
Protected Attributes | |
std::vector< double > | x_values_ |
std::vector< T > | y_values_ |
std::vector< T > | x_values_reversed_ |
std::vector< T > | y_values_reversed_ |
This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at possibly nonuniform points.
If values outside the domain are sought, values will be extrapolated linearly.
T | the range type of the function (should be an algebraic ring type) |
|
inline |
Construct from vectors of x and y values.
x_values | vector of domain values |
y_values | vector of corresponding range values. |
|
inline |
Evaluate the derivative at x.
x | a domain value |
|
inline |
Get the domain.
|
inline |
Evaluate the inverse at y.
Requires T to be a double.
y | a range value |
|
inline |
Evaluate the value at x.
x | a domain value |
|
inline |
Equality operator.
other | another NonuniformTableLinear. |
|
inline |
Rescale the domain.
new_domain | the new domain as a pair of doubles. |