22 #ifndef EDSP_TRIANGULAR_HPP 23 #define EDSP_TRIANGULAR_HPP 26 #include <edsp/meta/iterator.hpp> 29 namespace edsp {
namespace windowing {
43 template <
typename OutputIt>
44 constexpr
void triangular(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 rem = size + std::remainder(size, 2);
49 value_type initial = -(size - 1);
50 for (size_type i = 0; i < size; ++i, ++first) {
51 *first = 1 - std::abs(initial / rem);
58 #endif // EDSP_TRIANGULAR_HPP constexpr void triangular(OutputIt first, OutputIt last)
Computes a triangular window of length N and stores the result in the range, beginning at d_first...
Definition: triangular.hpp:44
constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
Definition: amplifier.hpp:29