20 #ifndef COMMON_MATH_HPP 21 #define COMMON_MATH_HPP 23 #include <Eigen/Geometry> 30 double lerp(
double a,
double b,
double f);
32 double polyval(
const Eigen::VectorXd& poly,
double val);
52 double griddata(
const Eigen::MatrixXd& x,
53 const Eigen::MatrixXd& y,
54 const Eigen::MatrixXd& z,
66 Eigen::VectorXd& polynomialCoeffs);
71 #endif // COMMON_MATH_HPP double lerp(double a, double b, double f)
size_t findPrevRowIdxInMonotonicSequence(const Eigen::MatrixXd &matrix, double key)
Given monotonic sequence (increasing or decreasing) and key, return the index of the previous element...
double polyval(const Eigen::VectorXd &poly, double val)
double griddata(const Eigen::MatrixXd &x, const Eigen::MatrixXd &y, const Eigen::MatrixXd &z, double x_val, double y_val)
bool calculatePolynomial(const Eigen::MatrixXd &table, double airSpeedMod, Eigen::VectorXd &polynomialCoeffs)
size_t findPrevRowIdxInIncreasingSequence(const Eigen::MatrixXd &table, double value)
Given an increasing sequence and a key, return the index of the previous element closest to the key...