20 #ifndef ANTKEEPER_MATH_POLYNOMIAL_HPP
21 #define ANTKEEPER_MATH_POLYNOMIAL_HPP
29 namespace polynomial {
40 template <
class InputIt,
class T>
41 [[nodiscard]] constexpr T
horner(InputIt first, InputIt last, T x)
44 for (++first; first != last; ++first)
65 template <
class InputIt,
class T>
66 [[nodiscard]] T
evaluate(InputIt first, InputIt last, T x)
77 for (; first != last; n2 = n1, n1 = n0)
95 template <
class InputIt,
class T>
96 [[nodiscard]] T
evaluate(InputIt first, InputIt last, T min, T max, T x)
98 return evaluate<InputIt, T>(first, last, math::map<T>(x,
min,
max, T{-1}, T{1}));
T evaluate(InputIt first, InputIt last, T x)
Evaluates a Chebyshev polynomial.
constexpr T horner(InputIt first, InputIt last, T x)
Evaluates a polynomial using Horner's method.
Mathematical functions and data types.
constexpr vector< T, N > max(const vector< T, N > &x, const vector< T, N > &y)
Returns a vector containing the maximum elements of two vectors.
constexpr vector< T, N > min(const vector< T, N > &x, const vector< T, N > &y)
Returns a vector containing the minimum elements of two vectors.