9#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_MATH_UTILS_BASICMATH_HPP
10#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_MATH_UTILS_BASICMATH_HPP
25 template<
typename T,
typename = std::enable_if_t<std::is_
integral_v<T> && !std::is_same_v<T,
bool>>>
38 template<
typename T,
typename = std::enable_if_t<std::is_
integral_v<T>>>
58 return value <= max && value >= min;
64 template<
int Min,
int Max,
typename T>
67 return withinRange(value,
static_cast<T
>(Min),
static_cast<T
>(Max));
85 std::vector<T> y(x.size());
87 T slope = (y2 - y1) / (x.back() - x.front());
88 T intercept = y1 - slope * x.front();
90 std::transform(x.begin(), x.end(), y.begin(), [=](
auto val) { return slope * val + intercept; });
Definition backwardsDifferenceMethod.hpp:20
constexpr bool withinRange(T value, T min, T max)
Definition basicMath.hpp:56
constexpr std::vector< T > linearlyInterpolate(const std::vector< T > &x, T y1, T y2)
Definition basicMath.hpp:83
constexpr bool isEven(T value)
Definition basicMath.hpp:26
constexpr bool isOdd(T value)
Definition basicMath.hpp:39