13 std::function<
double(
double)> f)
14 : x_min_(x_min), x_max_(x_min + range), inv_dx_(num / range) {
16 const double dx = range / num;
17 for (
int i = 0; i <= num; i++) {
48 std::min(static_cast<size_t>(index_double),
values_.size() - 2);
49 const double r = index_double -
n;
double get_value_linear(double x, Extrapolation extrapolation=Extrapolation::Linear) const
Look up a value from the tabulation using linear interpolation.
Extrapolation
The kind of extrapolation used by the tabulation.
Tabulation(double x_min, double range, int num, std::function< double(double)> f)
Construct a new tabulation object.
double get_value_step(double x) const
Look up a value from the tabulation (without any interpolation, simply using the closest tabulated va...
const double x_min_
lower bound for tabulation
const double x_max_
upper bound for tabulation
const double inv_dx_
inverse step size 1/dx
std::vector< double > values_
vector for storing tabulated values