32 namespace edsp {
namespace feature {
inline namespace temporal {
63 template <
typename InputIt,
typename OutputIt>
64 constexpr
void amdf(InputIt first, InputIt last, OutputIt d_first) {
65 using value_type =
typename std::iterator_traits<OutputIt>::value_type;
67 auto * array = &(*first);
68 for (
auto i = 0; i < N; ++i, ++d_first) {
69 for (
auto j = 0; j < (N - i); ++j) {
70 *d_first += std::abs(array[j] - array[j + i]);
72 *d_first /=
static_cast<value_type
>(N);
76 #endif //EDSP_ASDF_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