32 namespace edsp {
namespace feature {
inline namespace temporal {
50 template <
typename InputIt,
typename OutputIt>
51 constexpr
void amdf(InputIt first, InputIt last, OutputIt d_first) {
52 using value_type =
typename std::iterator_traits<OutputIt>::value_type;
54 auto * array = &(*first);
55 for (
auto i = 0; i < N; ++i, ++d_first) {
56 for (
auto j = 0; j < (N - i); ++j) {
57 *d_first += std::abs(array[j] - array[j + i]);
59 *d_first /=
static_cast<value_type
>(N);
63 #endif //EDSP_AMDF_HPP constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
constexpr void amdf(InputIt first, InputIt last, OutputIt d_first)
Computes the AMDF (Average Magnitude Difference Function) of the contiguous elements in the range [fi...
Definition: amdf.hpp:51
Definition: amplifier.hpp:29