22 #ifndef EDSP_WELCH_HPP 23 #define EDSP_WELCH_HPP 26 #include <edsp/meta/iterator.hpp> 29 namespace edsp {
namespace windowing {
43 template <
typename OutputIt>
44 constexpr
void welch(OutputIt first, OutputIt last) {
45 using value_type = meta::value_type_t<OutputIt>;
46 using size_type = meta::diff_type_t<OutputIt>;
47 const auto size =
static_cast<size_type
>(
std::distance(first, last));
48 const value_type L = size / 2;
49 for (size_type i = 0; i < size; ++i, ++first) {
50 *first = 1 -
math::square(static_cast<value_type>(i - L) / L);
56 #endif // EDSP_WELCH_HPP constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
constexpr T square(T x)
Computes the square value of the input number.
Definition: numeric.hpp:188
constexpr void welch(OutputIt first, OutputIt last)
Computes a Welch window of length N and stores the result in the range, beginning at d_first...
Definition: welch.hpp:44
Definition: amplifier.hpp:29