kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit e6fc78f462c9872d7867d83533ddf2438063c097
parent 51a01e140c8259bdfbe9c7ca98a3102ae4b92c61
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 12 Sep 2016 15:08:27 +0300

Expression for horner function

Diffstat:
Minclude/kfr/base/operators.hpp | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/kfr/base/operators.hpp b/include/kfr/base/operators.hpp @@ -486,13 +486,19 @@ constexpr CMT_INLINE common_type<T1, T2, T3, Ts...> horner(const T1& x, const T2 /// @brief Calculate polynomial using Horner's method /// /// ``horner(x, 1, 2, 3)`` is equivalent to \(3x^2 + 2x + 1\) -template <typename T1, typename... Ts> +template <typename T1, typename... Ts, KFR_ENABLE_IF(is_numeric_args<T1, Ts...>::value)> constexpr CMT_INLINE common_type<T1, Ts...> horner(const T1& x, const Ts&... c) { return internal::horner(x, c...); } KFR_FN(horner) +template <typename... E, KFR_ENABLE_IF(is_input_expressions<E...>::value)> +CMT_INLINE internal::expression_function<fn::horner, E...> horner(E&&... x) +{ + return { fn::horner(), std::forward<E>(x)... }; +} + /// @brief Calculate Multiplicative Inverse of `x` /// Returns `1/x` template <typename T>