Class LinearInterpolant¶
- Defined in File interp.h
Class Documentation¶
-
class
LinearInterpolant
¶ Public Functions
-
LinearInterpolant
(const Eigen::ArrayXd x_vec, const Eigen::ArrayXd y_vec)¶ Create a linear interpolant.
Initialise an interpolant as follows:
Eigen::ArrayXd xvals(3); Eigen::ArrayXd yvals(xvals.rows());
xvals << 0, 15, 30; yvals << 0, 12, 17;
LinearInterpolant s(xvals, yvals);
-
double
operator()
(double xi) const¶ Evaluate interpolant at values xi whose yi values are unknown.
Out of range xi values are constrained to the endpoints (i.e. nearest neighbour interpolation)
Performs linear interpolation to evaluate values yi at // … Initialise interpolant (see constructor) … LinearInterpolant s(xvals, yvals); std::cout << s(12.34) << std::endl;
- Return
- double interpolated value yi corresponding to location xi
- Parameters
xi
: double (or eigen ArrayXd) of target x values for the interpolation
-
Eigen::ArrayXd
operator()
(Eigen::ArrayXd const &xi_vec)¶
-