27 #include <edsp/meta/iterator.hpp> 29 namespace edsp {
namespace statistics {
46 template <distances d,
typename InputIt>
47 constexpr meta::value_type_t<InputIt>
flux(InputIt first1, InputIt last1, InputIt first2) {
48 using value_type = meta::value_type_t<InputIt>;
50 auto accumulated =
static_cast<value_type
>(0);
51 for (; first1 != last1; ++first1, ++first2) {
52 accumulated += distance<d>(*first1, *first2);
54 return accumulated /
static_cast<value_type
>(size);
61 #endif //EDSP_FLUX_HPP constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
constexpr meta::value_type_t< InputIt > flux(InputIt first1, InputIt last1, InputIt first2)
Computes the flux between the elements in the range [first1, last1) and the elements starting at firs...
Definition: flux.hpp:47
Definition: amplifier.hpp:29