eDSP  0.0.1
A cross-platform DSP library written in C++.
spectral_entropy.hpp
Go to the documentation of this file.
1 
27 #ifndef EDSP_SPECTRAL_ENTROPY_HPP
28 #define EDSP_SPECTRAL_ENTROPY_HPP
29 
31 #include <functional>
32 #include <algorithm>
33 
34 namespace edsp { namespace feature { inline namespace spectral {
35 
55  template <typename ForwardIt>
56  constexpr auto spectral_entropy(ForwardIt first, ForwardIt last) {
57  using value_type = typename std::iterator_traits<ForwardIt>::value_type ;
58  const auto acc = std::accumulate(first, last, static_cast<value_type >(0));
59  std::for_each(first, last, std::bind(std::multiplies<value_type>(), std::placeholders::_1, acc));
60  return statistics::entropy(first, last);
61  }
62 
63 }}}
64 #endif //EDSP_SPECTRAL_ENTROPY_HPP
constexpr auto spectral_entropy(ForwardIt first, ForwardIt last)
Computes the spectral entropy of the of the power spectral density represented by the elements in the...
Definition: spectral_entropy.hpp:56
constexpr meta::value_type_t< ForwardIt > entropy(ForwardIt first, ForwardIt last)
Computes the normalized entropy of the probability mass function given in the range [first...
Definition: entropy.hpp:51
Definition: amplifier.hpp:29