My Project
|
This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at uniform points. More...
#include <UniformTableLinear.hpp>
Public Types | |
enum | RangePolicy { Throw = 0 , ClosestValue = 1 , Extrapolate = 2 } |
Policies for how to behave when trying to evaluate outside the domain. | |
Public Member Functions | |
UniformTableLinear () | |
Default constructor. | |
UniformTableLinear (double xmin, double xmax, const std::vector< T > &y_values) | |
Construct from vector of y-values. | |
UniformTableLinear (double xmin, double xmax, const T *y_values, int num_y_values) | |
Construct from array of y-values. | |
std::pair< double, double > | domain () |
Get the domain. | |
void | rescaleDomain (std::pair< double, double > new_domain) |
Rescale the domain. | |
double | operator() (const double x) const |
Evaluate the value at x. | |
double | derivative (const double x) const |
Evaluate the derivative at x. | |
bool | operator== (const UniformTableLinear &other) const |
Equality operator. | |
void | setLeftPolicy (RangePolicy rp) |
Sets the behavioural policy for evaluation to the left of the domain. | |
void | setRightPolicy (RangePolicy rp) |
Sets the behavioural policy for evaluation to the right of the domain. | |
Protected Attributes | |
double | xmin_ |
double | xmax_ |
double | xdelta_ |
std::vector< T > | y_values_ |
RangePolicy | left_ |
RangePolicy | right_ |
Friends | |
template<typename U > | |
std::ostream & | operator<< (std::ostream &os, const UniformTableLinear< U > &t) |
This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at uniform points.
T | the range type of the function (should be an algebraic ring type) |
|
inline |
Construct from vector of y-values.
xmin | the x value corresponding to the first y value. |
xmax | the x value corresponding to the last y value. |
y_values | vector of range values. |
|
inline |
Construct from array of y-values.
xmin | the x value corresponding to the first y value. |
xmax | the x value corresponding to the last y value. |
y_values | array of range values. |
num_y_values | the number of values in y_values. |
|
inline |
Evaluate the derivative at x.
x | a domain value |
|
inline |
Get the domain.
|
inline |
Evaluate the value at x.
x | a domain value |
|
inline |
Equality operator.
other | another UniformTableLinear. |
|
inline |
Rescale the domain.
new_domain | the new domain as a pair of doubles. |
|
inline |
Sets the behavioural policy for evaluation to the left of the domain.
rp | the policy |
|
inline |
Sets the behavioural policy for evaluation to the right of the domain.
rp | the policy |