1 #ifndef NPSTAT_INTERPOLATE_HH_
2 #define NPSTAT_INTERPOLATE_HH_
36 return f1 + ((f2 - f0) / two + ((f2 - f1) + (f0 -
f1)) * (dx /
two)) *
dx;
76 "In npstat::interpolation_coefficients: "
77 "insufficient length of the output buffer");
87 "In npstat::interpolation_coefficients: "
88 "insufficient length of the output buffer");
90 buffer[1] =
static_cast<T>((f1 - f2 + 3 * (f1 - f0)) / 2.0);
91 buffer[2] =
static_cast<T>(((f0 -
f1) + (f2 - f1)) / 2.0);
97 T*
buffer,
const unsigned bufLen,
const T& f0,
const T&
f1,
const T&
f2,
const T& f3) {
100 "In npstat::interpolation_coefficients: "
101 "insufficient length of the output buffer");
103 buffer[1] =
static_cast<T>((11 * (f1 - f0) + 7 * (f1 - f2) + 2 * (f3 -
f2)) / 6.0);
104 buffer[2] =
static_cast<T>((2 * (f0 -
f1) + 3 * (f2 - f1) + (f2 - f3)) / 2.0);
105 buffer[3] =
static_cast<T>(((f3 - f0) + 3 * (f1 - f2)) / 6.0);
110 #endif // NPSTAT_INTERPOLATE_HH_
T interpolate_cubic(const double x, const T &f0, const T &f1, const T &f2, const T &f3)
T interpolate_quadratic(const double x, const T &f0, const T &f1, const T &f2)
Compile-time deduction of the underlying floating point type from the given complex type...
Exceptions for the npstat namespace.
unsigned interpolation_coefficients(T *buffer, unsigned bufLen, const T &f0, const T &f1)
T interpolate_linear(const double x, const T &f0, const T &f1)