27 #ifndef EDSP_SPECTRAL_VARIATION_HPP 28 #define EDSP_SPECTRAL_VARIATION_HPP 33 namespace edsp {
namespace feature {
inline namespace spectral {
56 template <
typename ForwardIt>
58 using value_type =
typename std::iterator_traits<ForwardIt>::value_type ;
59 auto sum_x1 =
static_cast<value_type
>(0);
60 auto sum_x2 =
static_cast<value_type
>(0);
61 auto sum_x12 =
static_cast<value_type
>(0);
62 for (; first1 != last1; ++first1, ++first2) {
65 sum_x12 += *first1 * *first2;
67 return 1 - sum_x2 / (std::sqrt(sum_x1) * std::sqrt(sum_x2));
72 #endif //EDSP_SPECTRAL_VARIATION_HPP constexpr auto spectral_variation(ForwardIt first1, ForwardIt last1, ForwardIt first2)
Computes the spectral variation of the of the magnitude spectrum represented by the elements in the r...
Definition: spectral_variation.hpp:57
Definition: amplifier.hpp:29