22 #ifndef EDSP_BLACKMAN_NUTTAL_HARRIS_HPP 23 #define EDSP_BLACKMAN_NUTTAL_HARRIS_HPP 26 #include <edsp/meta/iterator.hpp> 28 namespace edsp {
namespace windowing {
44 template <
typename OutputIt>
46 using value_type = meta::value_type_t<OutputIt>;
47 using size_type = meta::diff_type_t<OutputIt>;
48 constexpr
auto a0 =
static_cast<value_type
>(0.3635819);
49 constexpr
auto a1 =
static_cast<value_type
>(0.4891775);
50 constexpr
auto a2 =
static_cast<value_type
>(0.1365995);
51 constexpr
auto a3 =
static_cast<value_type
>(0.0106411);
52 const auto size =
static_cast<size_type
>(
std::distance(first, last));
53 const auto factor = constants<value_type>::two_pi /
static_cast<value_type
>(size - 1);
54 for (size_type i = 0; i < size; ++i, ++first) {
55 const value_type tmp = factor * i;
56 *first = a0 - a1 * std::cos(tmp) + a2 * std::cos(2 * tmp) - a3 * std::cos(3 * tmp);
62 #endif // EDSP_BLACKMAN_NUTTAL_HARRIS_HPP constexpr void blackman_nutall(OutputIt first, OutputIt last)
Computes a Blackman-Nuttall window of length N and stores the result in the range, beginning at d_first.
Definition: blackman_nuttall.hpp:45
constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
Definition: amplifier.hpp:29