1 #ifndef NPSTAT_INTERPOLATE_HH_
2 #define NPSTAT_INTERPOLATE_HH_
39 return f1 + ((f2 - f0)/two + ((f2 - f1) + (f0 -
f1))*(dx/two))*dx;
68 const T& f0,
const T&
f1);
71 const T& f0,
const T&
f1,
const T&
f2);
74 const T& f0,
const T&
f1,
84 const T& f0,
const T&
f1)
87 "In npstat::interpolation_coefficients: "
88 "insufficient length of the output buffer");
96 const T& f0,
const T&
f1,
const T&
f2)
99 "In npstat::interpolation_coefficients: "
100 "insufficient length of the output buffer");
102 buffer[1] =
static_cast<T>((f1 - f2 + 3*(f1 - f0))/2.0);
103 buffer[2] =
static_cast<T>(((f0 -
f1) + (f2 - f1))/2.0);
109 const T& f0,
const T&
f1,
113 "In npstat::interpolation_coefficients: "
114 "insufficient length of the output buffer");
116 buffer[1] =
static_cast<T>((11*(f1 - f0)+7*(f1 - f2)+2*(f3 -
f2))/6.0);
117 buffer[2] =
static_cast<T>((2*(f0 -
f1)+3*(f2 - f1)+(f2 -
f3))/2.0);
118 buffer[3] =
static_cast<T>(((f3 - f0) + 3*(f1 - f2))/6.0);
124 #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)