23 #ifndef EDSP_ROLLOFF_HPP 24 #define EDSP_ROLLOFF_HPP 28 namespace edsp {
namespace statistics {
41 template <
typename ForwardIt,
typename Floating>
42 constexpr
auto rolloff(ForwardIt first, ForwardIt last, Floating percentage) {
43 using input_t =
typename std::iterator_traits<ForwardIt>::value_type;
45 const auto limit = percentage *
energy;
46 for (input_t acc_energy = 0; first != last; ++first) {
47 acc_energy += (*first) * (*first);
48 if (acc_energy >= limit)
57 #endif //EDSP_ROLLOFF_HPP constexpr auto rolloff(ForwardIt first, ForwardIt last, Floating percentage)
Computes the roll-off index of the elements in the range [first, last)
Definition: rolloff.hpp:42
constexpr auto energy(ForwardIt first, ForwardIt last)
Computes the energy of the elements in the range [first, last)
Definition: energy.hpp:46
Definition: amplifier.hpp:29